Commit 81615b62 authored by Ingo Molnar's avatar Ingo Molnar Committed by Linus Torvalds

[PATCH] Convert kernel/cpu.c to mutexes

Convert kernel/cpu.c from semaphore to mutex.

I've reviewed all lock_cpu_hotplug() critical sections, and they all seem to
fit mutex semantics.
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
Cc: Rusty Russell <rusty@rustcorp.com.au>
Cc: Ashok Raj <ashok.raj@intel.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 1fb00c6c
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/stop_machine.h> #include <linux/stop_machine.h>
#include <asm/semaphore.h> #include <linux/mutex.h>
/* This protects CPUs going up and down... */ /* This protects CPUs going up and down... */
static DECLARE_MUTEX(cpucontrol); static DEFINE_MUTEX(cpucontrol);
static BLOCKING_NOTIFIER_HEAD(cpu_chain); static BLOCKING_NOTIFIER_HEAD(cpu_chain);
...@@ -30,9 +30,9 @@ static int __lock_cpu_hotplug(int interruptible) ...@@ -30,9 +30,9 @@ static int __lock_cpu_hotplug(int interruptible)
if (lock_cpu_hotplug_owner != current) { if (lock_cpu_hotplug_owner != current) {
if (interruptible) if (interruptible)
ret = down_interruptible(&cpucontrol); ret = mutex_lock_interruptible(&cpucontrol);
else else
down(&cpucontrol); mutex_lock(&cpucontrol);
} }
/* /*
...@@ -56,7 +56,7 @@ void unlock_cpu_hotplug(void) ...@@ -56,7 +56,7 @@ void unlock_cpu_hotplug(void)
{ {
if (--lock_cpu_hotplug_depth == 0) { if (--lock_cpu_hotplug_depth == 0) {
lock_cpu_hotplug_owner = NULL; lock_cpu_hotplug_owner = NULL;
up(&cpucontrol); mutex_unlock(&cpucontrol);
} }
} }
EXPORT_SYMBOL_GPL(unlock_cpu_hotplug); EXPORT_SYMBOL_GPL(unlock_cpu_hotplug);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment