mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Andi Kleen <andi@firstfloor.org>
Cc: "Ingo Molnar" <mingo@elte.hu>,
	"Roland McGrath" <roland@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org,
	"Elias Oltmanns" <eo@nebensachen.de>,
	"Török Edwin" <edwintorok@gmail.com>,
	"Arjan van de Ven" <arjan@infradead.org>
Subject: Re: [PATCH] x86_64: fix delayed signals
Date: Sun, 13 Jul 2008 10:32:09 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.1.10.0807131017180.2959@woody.linux-foundation.org> (raw)
In-Reply-To: <4879CCFD.70208@firstfloor.org>



On Sun, 13 Jul 2008, Andi Kleen wrote:
> 
> At least the original report was about Ctrl-C only versus Ctrl-Z.

Yes, and I explained why.

> I see the problem regularly myself that Ctrl-C doesn't work,
> but Ctrl-Z+kill does (although I unfortunately cannot
> reproduce it on demand).

There's no way you _can_ reproduce it.

> But it was with programs who shouldn't catch Ctrl-C, like find.

No, it was not. I think you misread it.

Two facts:

 - ^Z and ^C are both going to be equally fast if they aren't blocked.

   This is just how things are. They are handled by the same codepaths.

 - the report you point to does mention 'find', but *not* in the place 
   where it talks about "^Z+kill". There it's much less specific, and I 
   bet that Edwin _had_ seen the "^Z works" behavior, and knew it to be 
   true, but hadn't realized that it depended on the command, so when he 
   gave an example of something where disk IO makes signals slow, he 
   happened to pick one where ^Z and ^C were equally slow.

In other words, I can pretty much _guarantee_ that if ^Z+kill is faster 
than ^C, then it's because the process blocked or caught ^C.

And I can pretty much also guarantee that when Edwin talked about 'find' 
and did that ^C cut-and-paste, he didn't try the ^Z thing (that had 
happened with _other_ programs), or if he did, it was just happenstance 
(because the latency isn't _always_ 10-30 seconds - that's just the worst 
case).

So yes, ^C often works slower. If the process catches it and removes 
temporary files as a result (for example - it's what things like gcc do), 
then of _course_ it's going to be slower. It's going to be very noticeably 
slower, especially since removing a temp-file is going to be even more 
likely to hit a filesystem lock if the write-queues are full than just a 
normal read is.

But ^C isn't always slower, and if 'find' doesn't block/ignore it (and I 
certainly believe you when you say that it doesn't), then for the case of 
'find', it won't be true that ^Z+kill is any faster.

In fact, Edwin later in this thread reported:

  "Also I wasn't able to reproduce the  'Ctrl+Z works faster than Ctrl+C'
   symptom, perhaps it is just a coincidence: by the time I press Ctrl+Z to
   interrupt, enough time has passed (30+ secs), that the same effect would
   have been obtained by another Ctrl+C, or by just waiting."

and I bet that is exactly because now he's been testing programs that 
don't block ^C (ie maybe he's now testing _just_ that "find /" thing).

So before, Edwin was probably doing random things when doing "normal 
work", and noticed that ^Z was sometimes faster. Now, he's trying to chase 
things down, and he creates this specific test-case, and for that 
particular test-case, ^Z _isn't_ faster. He just didn't pick up on the 
pattern that it depends on which particular command he works on.

Try "yum list", and you'll certainly see that ^Z works a *lot* faster than 
^C (and the latter often needs multiple ^C's even when there is no load 
at all)

			Linus

  reply	other threads:[~2008-07-13 17:33 UTC|newest]

Thread overview: 46+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-10 21:50 Roland McGrath
2008-07-10 22:06 ` Linus Torvalds
2008-07-10 22:42   ` Roland McGrath
2008-07-10 22:51     ` Linus Torvalds
2008-07-10 23:02       ` Linus Torvalds
2008-07-11  0:52       ` Roland McGrath
2008-07-11  1:18         ` Linus Torvalds
2008-07-11  1:27           ` Roland McGrath
2008-07-11  1:48         ` Linus Torvalds
2008-07-11  2:02           ` Linus Torvalds
2008-07-11  2:22             ` Linus Torvalds
2008-07-11  2:26               ` Linus Torvalds
2008-07-12 12:24             ` Andi Kleen
2008-07-11  5:46 ` Ingo Molnar
2008-07-11 11:13   ` Török Edwin
2008-07-11 12:24   ` Elias Oltmanns
2008-07-11 17:58   ` Linus Torvalds
2008-07-11 18:07     ` Roland McGrath
2008-07-11 18:16       ` Linus Torvalds
2008-07-11 18:17         ` Linus Torvalds
2008-07-11 18:10     ` Linus Torvalds
2008-07-11 18:31       ` Linus Torvalds
2008-07-11 22:53         ` Arjan van de Ven
2008-07-12 10:33           ` Török Edwin
2008-07-11 20:37       ` Linus Torvalds
2008-07-11 23:22         ` Linus Torvalds
2008-07-12 10:32           ` Török Edwin
2008-07-12 13:42             ` Török Edwin
2008-07-12 14:55               ` Arjan van de Ven
2008-07-12 18:00                 ` Linus Torvalds
2008-07-12 18:15                   ` Arjan van de Ven
2008-07-12 18:28                     ` Linus Torvalds
2008-07-12 17:29             ` Linus Torvalds
2008-07-12 20:26               ` Török Edwin
2008-07-12 20:47                 ` Linus Torvalds
2008-07-12 20:57                 ` Denys Vlasenko
2008-07-13 10:46                   ` Oleg Nesterov
2008-07-13 12:34                     ` Denys Vlasenko
2008-07-13 18:36                     ` Linus Torvalds
2008-07-13 18:45                       ` Peter T. Breuer
2008-07-12 12:27     ` Andi Kleen
2008-07-12 17:41       ` Linus Torvalds
2008-07-13  9:38         ` Andi Kleen
2008-07-13 17:32           ` Linus Torvalds [this message]
2008-07-13 18:59             ` Andi Kleen
2008-07-13 19:08               ` Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=alpine.LFD.1.10.0807131017180.2959@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=andi@firstfloor.org \
    --cc=arjan@infradead.org \
    --cc=edwintorok@gmail.com \
    --cc=eo@nebensachen.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=roland@redhat.com \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®