From: Manfred Spraul <manfred@colorfullife.com>
To: Andrew Morton <akpm@osdl.org>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: prepare_wait / finish_wait question
Date: Sun, 09 Nov 2003 11:41:07 +0100 [thread overview]
Message-ID: <3FAE19C3.7060104@colorfullife.com> (raw)
In-Reply-To: <20031109021943.470fc601.akpm@osdl.org>
Andrew Morton wrote:
>Manfred Spraul <manfred@colorfullife.com> wrote:
>
>
>>Hi Ingo,
>>
>>sysv semaphores show the same problem you've fixed for wait queue with
>>finish_wait:
>>
>>
>
>Was me, actually.
>
>
Ups, sorry.
>It would be neater to remove the task from the list _before_ waking it up.
>The current code in there is careful to only remove the task if the wakeup
>attempt was successful, but I have a feeling that this is unnecessary - the
>waiting task will do the right thing. One would need to think about that a
>bit more.
>
>
Doesn't work: the woken up thread could be woken up by chance through a
signal, and then the task structure could go out of scope while wake_up
is still running - oops. Seen on s390 with sysv msg.
>>I wrote a patch for sysv sem and on a 4x Pentium 3, 99.9% of the calls
>>hit the fast path, but I'm a bit afraid that monitor/mwait could be so
>>fast that the fast path is not chosen.
>>
>>
>
>Is it not the case that ia32's reschedule IPI is async? If the
>architecture's reschedule uses a synchronous IPI then it could indeed be
>the case that the woken CPU gets there first.
>
poll_idle polls the need_resched flag, and next generation pentium 4
cpus will poll the need_resched flag with the MONITOR/MWAIT
instructions. We cannot rely on the async IPI.
>>I'm thinking about a two-stage algorithm - what's your opinion?
>>
>>
>
>Instrumentation on other architectures would be interesting.
>
>
The patch already contains the instrumentation - it only needs testing.
--
Manfred
next prev parent reply other threads:[~2003-11-09 10:42 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-11-09 9:00 prepare_wait / finish_wait question Manfred Spraul
2003-11-09 10:19 ` Andrew Morton
2003-11-09 10:41 ` Manfred Spraul [this message]
-- strict thread matches above, loose matches on Subject: below --
2003-11-12 5:19 Perez-Gonzalez, Inaky
2003-11-12 5:32 ` 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=3FAE19C3.7060104@colorfullife.com \
--to=manfred@colorfullife.com \
--cc=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
/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