diff options
author | Ashok Raj <ashok.raj@intel.com> | 2005-11-28 16:43:46 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-11-28 17:42:23 -0500 |
commit | a9d9baa1e819b2f92f9cfa5240f766c535e636a6 (patch) | |
tree | 0ae15e5b1071b395affa0ac9abf6fd746ad60b0e /include | |
parent | e0f39591cc178026607fcbbe9a53be435fe8285d (diff) |
[PATCH] clean up lock_cpu_hotplug() in cpufreq
There are some callers in cpufreq hotplug notify path that the lowest
function calls lock_cpu_hotplug(). The lock is already held during
cpu_up() and cpu_down() calls when the notify calls are broadcast to
registered clients.
Ideally if possible, we could disable_preempt() at the highest caller and
make sure we dont sleep in the path down in cpufreq->driver_target() calls
but the calls are so intertwined and cumbersome to cleanup.
Hence we consistently use lock_cpu_hotplug() and unlock_cpu_hotplug() in
all places.
- Removed export of cpucontrol semaphore and made it static.
- removed explicit uses of up/down with lock_cpu_hotplug()
so we can keep track of the the callers in same thread context and
just keep refcounts without calling a down() that causes a deadlock.
- Removed current_in_hotplug() uses
- Removed PF_HOTPLUG_CPU in sched.h introduced for the current_in_hotplug()
temporary workaround.
Tested with insmod of cpufreq_stat.ko, and logical online/offline
to make sure we dont have any hang situations.
Signed-off-by: Ashok Raj <ashok.raj@intel.com>
Cc: Zwane Mwaikambo <zwane@linuxpower.ca>
Cc: Shaohua Li <shaohua.li@intel.com>
Cc: "Siddha, Suresh B" <suresh.b.siddha@intel.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/cpu.h | 7 | ||||
-rw-r--r-- | include/linux/sched.h | 1 |
2 files changed, 3 insertions, 5 deletions
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index 43c44530ef9d..0ed1d4853c69 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -65,10 +65,9 @@ extern struct sysdev_class cpu_sysdev_class; | |||
65 | 65 | ||
66 | #ifdef CONFIG_HOTPLUG_CPU | 66 | #ifdef CONFIG_HOTPLUG_CPU |
67 | /* Stop CPUs going up and down. */ | 67 | /* Stop CPUs going up and down. */ |
68 | extern struct semaphore cpucontrol; | 68 | extern void lock_cpu_hotplug(void); |
69 | #define lock_cpu_hotplug() down(&cpucontrol) | 69 | extern void unlock_cpu_hotplug(void); |
70 | #define unlock_cpu_hotplug() up(&cpucontrol) | 70 | extern int lock_cpu_hotplug_interruptible(void); |
71 | #define lock_cpu_hotplug_interruptible() down_interruptible(&cpucontrol) | ||
72 | #define hotcpu_notifier(fn, pri) { \ | 71 | #define hotcpu_notifier(fn, pri) { \ |
73 | static struct notifier_block fn##_nb = \ | 72 | static struct notifier_block fn##_nb = \ |
74 | { .notifier_call = fn, .priority = pri }; \ | 73 | { .notifier_call = fn, .priority = pri }; \ |
diff --git a/include/linux/sched.h b/include/linux/sched.h index 2038bd27b041..b0ad6f30679e 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -908,7 +908,6 @@ do { if (atomic_dec_and_test(&(tsk)->usage)) __put_task_struct(tsk); } while(0) | |||
908 | #define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ | 908 | #define PF_SYNCWRITE 0x00200000 /* I am doing a sync write */ |
909 | #define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ | 909 | #define PF_BORROWED_MM 0x00400000 /* I am a kthread doing use_mm */ |
910 | #define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ | 910 | #define PF_RANDOMIZE 0x00800000 /* randomize virtual address space */ |
911 | #define PF_HOTPLUG_CPU 0x01000000 /* Currently performing CPU hotplug */ | ||
912 | 911 | ||
913 | /* | 912 | /* |
914 | * Only the _current_ task can read/write to tsk->flags, but other | 913 | * Only the _current_ task can read/write to tsk->flags, but other |