Re: something to experiment with: LIFO and accept()

Linus Torvalds (torvalds@transmeta.com)
10 Apr 1997 05:35:28 GMT


In article <199704092346.TAA01211@jenolan.caipgeneral>,
David S. Miller <davem@jenolan.rutgers.edu> wrote:
> From: alan@lxorguk.ukuu.org.uk (Alan Cox)
> Date: Wed, 9 Apr 1997 23:36:52 +0100 (BST)
>
> > running stable then benchmark it. Now hack your linux kernel to
> > wake tasks in LIFO order out of accept() and benchmark again.
>
> Linux has no "wake_one" semantic in the scheduling. This is going
> to become an issue for 2.1 when we have the fine grained SMP sane
> as without it we get the so called "thundering herd" problems.
>
>Yes, but please make note that there will remain major cases where
>wake_one() can not and will not work, pipes come to mind firstly.

Much worse than pipes is "select()".

You _have_ to wake up anyone waiting with select(), because you cannot
know if any of those select()ers are actually going to then do what
their waiting implies they _may_ do after they wake up.

Essentially, "wake_one()" and "select()" do not mix - they simply
_cannot_ mix. Anybody thinking about wake_one() should think very hard
and very long about the select case, and you'll eventually come to
understand why Linux doesn't currently have a notion of waking up just
one process.

(There are other reasons, but select() is one of the major ones. But it
can be worked on, and we certainly want to have some limited kind of
wake_one() semantics eventually. I just want to make it clear that the
issue isn't as simple as some people make it out to be).

Linus