android_kernel_xiaomi_sm8350/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
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
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
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
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
linux [PATCH] cpusets: dual semaphore locking overhaul 2005-10-30 17:37:21 -08:00
math-emu
media
mtd
net
pcmcia
rdma
rxrpc
scsi
sound
video