smp/hotplug changes for v3.9
Linus,
Please pull the latest smp-hotplug-for-linus git tree from:
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip.git smp-hotplug-for-linus
HEAD: 14e568e78f6f80ca1e27256641ddf524c7dbdc51 stop_machine: Use smpboot threads
Some early preparatory changes for the WIP hotplug rework by Thomas Gleixner.
Thanks,
Ingo
------------------>
Thomas Gleixner (3):
smpboot: Allow selfparking per cpu threads
stop_machine: Store task reference in a separate per cpu variable
stop_machine: Use smpboot threads
include/linux/smpboot.h | 5 ++ kernel/cpu.c | 2 + kernel/smpboot.c | 5 +- kernel/stop_machine.c | 156 +++++++++++++++++++----------------------------- 4 files changed, 70 insertions(+), 98 deletions(-)
include/linux/smpboot.h +5 -0
@@ -14,6 +14,8 @@ struct smpboot_thread_data;* @thread_should_run: Check whether the thread should run or not. Called with * preemption disabled. * @thread_fn: The associated thread function +* @create: Optional setup function, called when the thread gets +* created (Not called from the thread context) * @setup: Optional setup function, called when the thread gets * operational the first time * @cleanup: Optional cleanup function, called when the thread
@@ -22,6 +24,7 @@ struct smpboot_thread_data;* parked (cpu offline) * @unpark: Optional unpark function, called when the thread is * unparked (cpu online) +* @selfparking: Thread is not parked by the park function. * @thread_comm: The base name of the thread */ struct smp_hotplug_thread {
@@ -29,10 +32,12 @@ struct smp_hotplug_thread {struct list_head list;int (*thread_should_run)(unsigned int cpu);void (*thread_fn)(unsigned int cpu); +void (*create)(unsigned int cpu);void (*setup)(unsigned int cpu);void (*cleanup)(unsigned int cpu,bool online);void (*park)(unsigned int cpu);void (*unpark)(unsigned int cpu); +bool selfparking;const char *thread_comm; };
kernel/cpu.c +2 -0
@@ -254,6 +254,8 @@ static int __ref take_cpu_down(void *_param)return err;cpu_notify (CPU_DYING | param->mod, param->hcpu); +/* Park the stopper thread */ +kthread_park (current);return 0 ; }
kernel/smpboot.c +3 -2
@@ -183,9 +183,10 @@ __smpboot_create_thread(struct smp_hotplug_thread *ht, unsigned int cpu)kfree (td);return PTR_ERR (tsk); } -get_task_struct (tsk); *per_cpu_ptr (ht->store, cpu) = tsk; +if (ht->create) + ht->create (cpu);return 0 ; }
@@ -225,7 +226,7 @@ static void smpboot_park_thread(struct smp_hotplug_thread *ht, unsigned int cpu) {struct task_struct *tsk = *per_cpu_ptr (ht->store, cpu); -if (tsk) +if (tsk && !ht->selfparking)kthread_park (tsk); }
kernel/stop_machine.c +60 -96
246 lines not on this page · raw message
kernel/stop_machine.c repeat: · line 317
Quoted 4 lines · Ingo Molnar
kernel/stop_machine.c +4
-0+/* drain remaining works */ +spin_lock_irqsave (&stopper->lock, flags); +list_for_each_entry (work, &stopper->works, list) +cpu_stop_signal_done (work->done, false);
After flushing enqueued works, in what state is the works list head, Thomas?
Quoted 3 lines
kernel/stop_machine.c +2
-0+ stopper->enabled = false; +spin_unlock_irqrestore (&stopper->lock, flags); }