alistair23-linux/include
Paul Jackson 053199edf5 [PATCH] cpusets: dual semaphore locking overhaul
Overhaul cpuset locking.  Replace single semaphore with two semaphores.

The suggestion to use two locks was made by Roman Zippel.

Both locks are global.  Code that wants to modify cpusets must first
acquire the exclusive manage_sem, which allows them read-only access to
cpusets, and holds off other would-be modifiers.  Before making actual
changes, the second semaphore, callback_sem must be acquired as well.  Code
that needs only to query cpusets must acquire callback_sem, which is also a
global exclusive lock.

The earlier problems with double tripping are avoided, because it is
allowed for holders of manage_sem to nest the second callback_sem lock, and
only callback_sem is needed by code called from within __alloc_pages(),
where the double tripping had been possible.

This is not quite the same as a normal read/write semaphore, because
obtaining read-only access with intent to change must hold off other such
attempts, while allowing read-only access w/o such intention.  Changing
cpusets involves several related checks and changes, which must be done
while allowing read-only queries (to avoid the double trip), but while
ensuring nothing changes (holding off other would be modifiers.)

This overhaul of cpuset locking also makes careful use of task_lock() to
guard access to the task->cpuset pointer, closing a couple of race
conditions noticed while reading this code (thanks, Roman).  I've never
seen these races fail in any use or test.

See further the comments in the code.

Signed-off-by: Paul Jackson <pj@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2005-10-30 17:37:21 -08:00
..
acpi [ACPI] ACPICA 20050902 2005-09-03 00:15:11 -04:00
asm-alpha [PATCH] add sem_is_read/write_locked() 2005-10-29 21:40:35 -07:00
asm-arm [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-arm26 [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-cris [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-frv [PATCH] gfp_t: dma-mapping (frv) 2005-10-28 08:16:48 -07:00
asm-generic [PATCH] mm: update comments to pte lock 2005-10-29 21:40:42 -07:00
asm-h8300 [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-i386 [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-ia64 [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-m32r [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-m68k [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-m68knommu [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-mips [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-parisc [PATCH] adjust parisc sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-powerpc [PATCH] ppc32: Fix timekeeping 2005-10-12 08:24:47 -07:00
asm-ppc [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-ppc64 [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-s390 [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-sh [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-sh64 [PATCH] gfp_t: dma-mapping (simple cases) 2005-10-28 08:16:49 -07:00
asm-sparc [PATCH] remove some more check_region stuff 2005-10-30 17:37:18 -08:00
asm-sparc64 [PATCH] mm: tlb_finish_mmu forget rss 2005-10-29 21:40:37 -07:00
asm-um [PATCH] uml: remove old UM_FASTCALL, and make the thing work again 2005-10-30 17:37:16 -08:00
asm-v850 [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-x86_64 [PATCH] unify sys_ptrace prototype 2005-10-30 17:37:20 -08:00
asm-xtensa [PATCH] gfp_t: dma-mapping (xtensa) 2005-10-28 08:16:49 -07:00
linux [PATCH] cpusets: dual semaphore locking overhaul 2005-10-30 17:37:21 -08:00
math-emu
media [PATCH] i2c: ID redefinition cleanups 2005-10-28 14:02:13 -07:00
mtd
net Merge branch 'upstream-linus' of master.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6 2005-10-29 11:25:16 -07:00
pcmcia [PATCH] yenta: auto-tune EnE bridges for CardBus cards 2005-09-26 13:09:20 +02:00
rdma [IB] Fix MAD layer DMA mappings to avoid touching data buffer once mapped 2005-10-25 10:51:39 -07:00
rxrpc [PATCH] gfp flags annotations - part 1 2005-10-08 15:00:57 -07:00
scsi Merge branch 'master' 2005-10-28 12:31:34 -04:00
sound [PATCH] gfp_t: sound 2005-10-28 08:16:50 -07:00
video [PATCH] drivers/video: Replace custom macro with isdigit() 2005-09-13 08:22:33 -07:00