mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Linus Torvalds <torvalds@linux-foundation.org>
To: Ingo Molnar <mingo@elte.hu>
Cc: "Roland McGrath" <roland@redhat.com>,
	"Thomas Gleixner" <tglx@linutronix.de>,
	"Andrew Morton" <akpm@linux-foundation.org>,
	"Linux Kernel Mailing List" <linux-kernel@vger.kernel.org>,
	"Elias Oltmanns" <eo@nebensachen.de>,
	"Török Edwin" <edwintorok@gmail.com>,
	"Arjan van de Ven" <arjan@infradead.org>,
	"Oleg Nesterov" <oleg@tv-sign.ru>
Subject: Re: [PATCH] x86_64: fix delayed signals
Date: Fri, 11 Jul 2008 13:37:22 -0700 (PDT)	[thread overview]
Message-ID: <alpine.LFD.1.10.0807111337060.2873@woody.linux-foundation.org> (raw)
In-Reply-To: <alpine.LFD.1.10.0807111102450.2936@woody.linux-foundation.org>



On Fri, 11 Jul 2008, Linus Torvalds wrote:
> 
> Btw, did any of the impacted people test -rc9? Edwin's report is about 
> -rc2 and -rc8, and one of the things we fixed since -rc8 is that incorrect 
> and unintentional nr_zones zeroing that effectively disabled kswapd - and 
> made everybody do synchronous memory freeing when they wanted to allocate 
> more memory.. That can play havoc with any interactive stuff.

No, after testing more, I think Edwin is right.

There _does_ seem to be something wrong in signal handling when the signal 
happens during 'D' state (although I guess it could also be an artifact of 
other scheduling activity). I just put my machine under heavy read load by 
having a background process that does

	while : ; do echo 3 > /proc/sys/vm/drop_caches ; sleep 5; done

to flush the caches all the time, and then doing endless loops of "git 
grep" and other things, and I can definitely re-create the bad latency.

The best example is doing just

	[torvalds@woody ~]$ ls -l /usr/bin
	^Ctotal 367720
	-rwxr-xr-x 1 root root       43648 2008-07-04 09:35 [
	[torvalds@woody ~]$

and there are several seconds between the '^C' and the printout of the two 
lines (after which the 'ls' finally dies).

Perhaps more interestingly: when this happens (it doesn't happen all the 
time), it will _always_ die at the first two lines of printout for me, on 
two different machines: ie I *always* get that exact pattern of those two 
lines printed out (except when it reacts immediately, or when I press ^C 
so late that it has printed out much more).

And it's not some single system call latency that is long. I checked with 
strace, and while the IO load is high and causes the whole 'ls' to take a 
long time (up to 10 seconds - /usr/bin is *big*), each individual system 
call never takes very long. The longest system call latency I saw was 0.24 
seconds, which was for some very unlucky lstat() calls. Most of them were 
in the millisecond range, even though they obviously had to do IO.

More tellingly, those two writes are simply not even done with a single 
system call. The 'strace' for an 'ls -l' shows

	...
	write(1, "total 367720\n", 13) = 13 <0.000085>
	open("/etc/localtime", O_RDONLY) = 3 <0.000016>
	fstat(3, {st_mode=S_IFREG|0644, st_size=2819, ...}) = 0 <0.000004>
	fstat(3, {st_mode=S_IFREG|0644, st_size=2819, ...}) = 0 <0.000004>
	mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f6d996dd000 <0.000006>
	read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\4\0\0\0\4\0\0\0\0"..., 4096) = 2819 <0.041416>
	lseek(3, -1802, SEEK_CUR) = 1017 <0.000005>
	read(3, "TZif2\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\5\0\0\0\5\0\0\0\0"..., 4096) = 1802 <0.000006>
	close(3)              = 0 <0.000006>
	munmap(0x7f6d996dd000, 4096) = 0 <0.000014>
	write(1, "-rwxr-xr-x 1 root root       436"..., 54) = 54 <0.000008>
	...

so there is actually *many* system calls in there between the header line 
that does the 'total' and the first line of actual real output, but 
despite that, it reacts to the ^C consistently after the second line.

Very odd.

And the problem definitely happens on x86-32 too.

It also happens on the text console, so this is not some bad interaction 
with X and pty's and xterm or gnome-terminal or something like that. At 
first I thought "no way can that actually happen, I think the terminal is 
broken and only sends the signal after it has seen output", but no, it 
happens for me in text-mode too.

Oleg added to the Cc as the master of signal handling code.

			Linus

  parent reply	other threads:[~2008-07-11 20:38 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 [this message]
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
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.0807111337060.2873@woody.linux-foundation.org \
    --to=torvalds@linux-foundation.org \
    --cc=akpm@linux-foundation.org \
    --cc=arjan@infradead.org \
    --cc=edwintorok@gmail.com \
    --cc=eo@nebensachen.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=oleg@tv-sign.ru \
    --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®