From: Rusty Russell <rusty@rustcorp.com.au>
To: Ray Bryant <raybry@sgi.com>
Cc: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@digeo.com>,
Manfred Spraul <manfred@colorfullife.com>,
Andi Kleen <ak@suse.de>,
alan@lxorguk.ukuu.org.uk
Subject: Re: PROBLEM: Bug in __pollwait() can cause select() and poll() to hang in 2.4.22-pre2 -- second try
Date: Mon, 30 Jun 2003 14:34:50 +1000 [thread overview]
Message-ID: <20030630051515.E9F992C0D5@lists.samba.org> (raw)
In-Reply-To: Your message of "Fri, 27 Jun 2003 13:19:20 EST." <3EFC8AA8.7000501@sgi.com>
In message <3EFC8AA8.7000501@sgi.com> you write:
> The simplest fix (as suggested by Manfred Spraul) is to set
> current=>state to TASK_RUNNING just before the call to yield() in
> __alloc_pages(). I have tested this sufficiently that I believe
> this does not change the user level semantics of select() (my
> concern was that if state got set to TASK_RUNNING that the syscall
> could return before any fd's are ready or the select() timeout has
> expired, but this does not appear to be the case).
Horrible problem. Solution presented is icky, and at the *very* least
needs a comment about its relationship to poll.
More logical would be to have the set_task_state() before
__get_free_page() inside __pollwait, but that will cause every poll to
spin once, killing performance. Allocating the first page up front
(inside do_pollfd and do_select) would help that, but slow down the
case where normally no alloc is needed, which might be common. Having
a small first table inside the poll_table itself would work, but the
POLL_TABLE_FULL() macro then gets more complicated.
2.5 has exactly the same issue: perhaps 2.4 should take this patch,
and 2.5 should try something better (I'd suggest trying the embedded
minitable approach).
Anyway, my point is that it's not suitable for the Trivial Patch
Monkey 8)
> Here is a trivial patch against 2.4.22-pre2:
>
> --- linux-2.4.22-pre2.orig/mm/page_alloc.c Thu Nov 28 17:53:15 2002
> +++ linux-2.4.22-pre2/mm/page_alloc.c Fri Jun 27 13:47:49 2003
> @@ -418,6 +418,7 @@
> return NULL;
>
> /* Yield for kswapd, and try again */
> + set_current_state(TASK_RUNNING);
> yield();
> goto rebalance;
> }
Cheers,
Rusty.
--
Anyone who quotes me in their sig is an idiot. -- Rusty Russell.
next prev parent reply other threads:[~2003-06-30 5:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-06-27 18:19 PROBLEM: Bug in __pollwait() can cause select() and poll() to hang in 2.4.22-pre2 -- second try Ray Bryant
2003-06-30 4:34 ` Rusty Russell [this message]
2003-06-30 16:24 ` Manfred Spraul
2003-07-01 1:17 ` Rusty Russell
2003-07-01 4:17 ` Linus Torvalds
2003-07-01 5:08 ` Rusty Russell
2003-07-02 18:06 ` Ray Bryant
2003-07-03 0:56 ` Rusty Russell
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=20030630051515.E9F992C0D5@lists.samba.org \
--to=rusty@rustcorp.com.au \
--cc=linux-kernel@vger.kernel.org \
--cc=raybry@sgi.com \
/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