1
0
Fork 0
alistair23-linux/include
Johannes Weiner 777c6c5f1f wait: prevent exclusive waiter starvation
With exclusive waiters, every process woken up through the wait queue must
ensure that the next waiter down the line is woken when it has finished.

Interruptible waiters don't do that when aborting due to a signal.  And if
an aborting waiter is concurrently woken up through the waitqueue, noone
will ever wake up the next waiter.

This has been observed with __wait_on_bit_lock() used by
lock_page_killable(): the first contender on the queue was aborting when
the actual lock holder woke it up concurrently.  The aborted contender
didn't acquire the lock and therefor never did an unlock followed by
waking up the next waiter.

Add abort_exclusive_wait() which removes the process' wait descriptor from
the waitqueue, iff still queued, or wakes up the next waiter otherwise.
It does so under the waitqueue lock.  Racing with a wake up means the
aborting process is either already woken (removed from the queue) and will
wake up the next waiter, or it will remove itself from the queue and the
concurrent wake up will apply to the next waiter after it.

Use abort_exclusive_wait() in __wait_event_interruptible_exclusive() and
__wait_on_bit_lock() when they were interrupted by other means than a wake
up through the queue.

[akpm@linux-foundation.org: coding-style fixes]
Reported-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
Mentored-by: Oleg Nesterov <oleg@redhat.com>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Matthew Wilcox <matthew@wil.cx>
Cc: Chuck Lever <cel@citi.umich.edu>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: <stable@kernel.org>		["after some testing"]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2009-02-05 12:56:48 -08:00
..
acpi ACPI: fix ACPI_FADT_S4_RTC_WAKE comment 2009-01-16 14:32:17 -05:00
asm-arm [ARM] S3C24XX: Move mci.h to arch/arm/plat-s3c24xx/include/plat 2008-10-30 10:17:16 +00:00
asm-frv byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
asm-generic Merge branch 'x86-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip 2009-01-26 09:47:28 -08:00
asm-h8300
asm-m32r byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
asm-mn10300 byteorder: make swab.h include asm/swab.h like a regular header 2009-01-14 19:56:50 -08:00
crypto crypto: aes - Precompute tables 2008-12-25 11:05:13 +11:00
drm drm: Rip out the racy, unused vblank signal code. 2009-01-28 07:50:14 -08:00
keys KEYS: Disperse linux/key_ui.h 2008-11-14 10:39:13 +11:00
linux wait: prevent exclusive waiter starvation 2009-02-05 12:56:48 -08:00
math-emu math-emu: Fix thinko in _FP_DIV 2008-10-22 22:09:59 -07:00
media Merge branch 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-2.6 2009-02-02 19:26:06 -08:00
mtd headers_check fix: mtd/inftl-user.h 2009-01-31 00:13:34 +05:30
net net: wrong test in inet_ehash_locks_alloc() 2009-01-27 17:45:10 -08:00
pcmcia
rdma
rxrpc
scsi [SCSI] iscsi_tcp: make padbuf non-static 2009-01-13 10:41:34 -06:00
sound headers_check fix: sound/hdsp.h 2009-01-31 00:13:56 +05:30
trace sched, trace: update trace_sched_wakeup() 2008-12-25 13:10:21 +01:00
video headers_check fix: video/uvesafb.h 2009-01-31 00:14:52 +05:30
xen xen: add xenfs to allow usermode <-> Xen interaction 2009-01-08 08:30:59 -08:00
Kbuild