linux/kernel
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
..
irq
power [PATCH] introduce .valid callback for pm_ops 2005-10-30 17:37:15 -08:00
acct.c [PATCH] mm: rss = file_rss + anon_rss 2005-10-29 21:40:38 -07:00
audit.c [PATCH] gfp_t: kernel/* 2005-10-28 08:16:49 -07:00
auditsc.c [PATCH] gfp_t: kernel/* 2005-10-28 08:16:49 -07:00
capability.c
compat.c
configs.c
cpu.c [PATCH] create and destroy cpufreq sysfs entries based on cpu notifiers 2005-10-30 17:37:14 -08:00
cpuset.c [PATCH] cpusets: dual semaphore locking overhaul 2005-10-30 17:37:21 -08:00
crash_dump.c
dma.c
exec_domain.c
exit.c [PATCH] mm: update_hiwaters just in time 2005-10-29 21:40:39 -07:00
extable.c
fork.c [PATCH] mm: ptd_alloc take ptlock 2005-10-29 21:40:40 -07:00
futex.c [PATCH] mm: follow_page with inner ptlock 2005-10-29 21:40:41 -07:00
intermodule.c
itimer.c
kallsyms.c
Kconfig.hz
Kconfig.preempt
kexec.c [PATCH] mm: split page table lock 2005-10-29 21:40:42 -07:00
kfifo.c [PATCH] gfp flags annotations - part 1 2005-10-08 15:00:57 -07:00
kmod.c
kprobes.c
ksysfs.c
kthread.c [PATCH] Add kthread_stop_sem() 2005-10-30 17:37:17 -08:00
Makefile [PATCH] Remove redundant configs.o 2005-10-30 17:37:10 -08:00
module.c
panic.c
params.c [PATCH] Ignore trailing whitespace on kernel parameters correctly 2005-09-28 07:46:41 -07:00
pid.c
posix-cpu-timers.c [PATCH] Yet more posix-cpu-timer fixes 2005-10-27 09:08:43 -07:00
posix-timers.c [PATCH] posix-timers: use schedule_timeout() in common_nsleep() 2005-10-30 17:37:20 -08:00
printk.c [PATCH] Add printk_clock() 2005-09-21 10:11:54 -07:00
profile.c
ptrace.c
rcupdate.c [PATCH] rcu: keep rcu callback event counter 2005-10-17 15:27:58 -07:00
resource.c
sched.c [PATCH] mm: update_hiwaters just in time 2005-10-29 21:40:39 -07:00
seccomp.c
signal.c [PATCH] Unify sys_tkill() and sys_tgkill() 2005-10-30 17:37:19 -08:00
softirq.c
softlockup.c
spinlock.c
stop_machine.c
sys_ni.c
sys.c [PATCH] reboot: comment and factor the main reboot functions 2005-09-22 22:17:33 -07:00
sysctl.c
time.c [PATCH] NTP shift_right cleanup 2005-10-30 17:37:18 -08:00
timer.c [PATCH] remove timer debug field 2005-10-30 17:37:18 -08:00
uid16.c
user.c
wait.c
workqueue.c [PATCH] Use alloc_percpu to allocate workqueues locally 2005-10-30 17:37:18 -08:00