From: Andrew Morton <akpm@osdl.org>
To: Manfred Spraul <manfred@colorfullife.com>
Cc: mingo@elte.hu, linux-kernel@vger.kernel.org
Subject: Re: prepare_wait / finish_wait question
Date: Sun, 9 Nov 2003 02:19:43 -0800 [thread overview]
Message-ID: <20031109021943.470fc601.akpm@osdl.org> (raw)
In-Reply-To: <3FAE0223.7070402@colorfullife.com>
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.
> one thread wakes up a blocked thread and must hold a spinlock for the
> wakeup. The blocked thread immediately tries to acquire that spinlock,
> because it must figure out what happened. Result: noticable cache line
> trashing on an 4xXeon with postgres.
> autoremove_wake_function first calls wake_up, then list_del_init. Did
> you test that the woken up thread is not too fast and acquires the
> spinlock before list_del_init had a chance to reset the list?
No, I didn't instrument it. But profiling showed that it was working as
desired. The workload was tons of disk I/O, showing significant CPU time
in the page lock/unlock functions.
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.
> 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.
> I'm thinking about a two-stage algorithm - what's your opinion?
Instrumentation on other architectures would be interesting.
next prev parent reply other threads:[~2003-11-09 10:16 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 [this message]
2003-11-09 10:41 ` Manfred Spraul
-- 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=20031109021943.470fc601.akpm@osdl.org \
--to=akpm@osdl.org \
--cc=linux-kernel@vger.kernel.org \
--cc=manfred@colorfullife.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.