summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/smpboot.h5
-rw-r--r--kernel/smpboot.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/include/linux/smpboot.h b/include/linux/smpboot.h
index e0106d8581d3..c65dee059913 100644
--- a/include/linux/smpboot.h
+++ b/include/linux/smpboot.h
@@ -14,6 +14,8 @@ struct smpboot_thread_data;
14 * @thread_should_run: Check whether the thread should run or not. Called with 14 * @thread_should_run: Check whether the thread should run or not. Called with
15 * preemption disabled. 15 * preemption disabled.
16 * @thread_fn: The associated thread function 16 * @thread_fn: The associated thread function
17 * @create: Optional setup function, called when the thread gets
18 * created (Not called from the thread context)
17 * @setup: Optional setup function, called when the thread gets 19 * @setup: Optional setup function, called when the thread gets
18 * operational the first time 20 * operational the first time
19 * @cleanup: Optional cleanup function, called when the thread 21 * @cleanup: Optional cleanup function, called when the thread
@@ -22,6 +24,7 @@ struct smpboot_thread_data;
22 * parked (cpu offline) 24 * parked (cpu offline)
23 * @unpark: Optional unpark function, called when the thread is 25 * @unpark: Optional unpark function, called when the thread is
24 * unparked (cpu online) 26 * unparked (cpu online)
27 * @selfparking: Thread is not parked by the park function.
25 * @thread_comm: The base name of the thread 28 * @thread_comm: The base name of the thread
26 */ 29 */
27struct smp_hotplug_thread { 30struct smp_hotplug_thread {
@@ -29,10 +32,12 @@ struct smp_hotplug_thread {
29 struct list_head list; 32 struct list_head list;
30 int (*thread_should_run)(unsigned int cpu); 33 int (*thread_should_run)(unsigned int cpu);
31 void (*thread_fn)(unsigned int cpu); 34 void (*thread_fn)(unsigned int cpu);
35 void (*create)(unsigned int cpu);
32 void (*setup)(unsigned int cpu); 36 void (*setup)(unsigned int cpu);
33 void (*cleanup)(unsigned int cpu, bool online); 37 void (*cleanup)(unsigned int cpu, bool online);
34 void (*park)(unsigned int cpu); 38 void (*park)(unsigned int cpu);
35 void (*unpark)(unsigned int cpu); 39 void (*unpark)(unsigned int cpu);
40 bool selfparking;
36 const char *thread_comm; 41 const char *thread_comm;
37}; 42};
38 43
diff --git a/kernel/smpboot.c b/kernel/smpboot.c
index d6c5fc054242..d4abac261779 100644
--- a/kernel/smpboot.c
+++ b/kernel/smpboot.c
@@ -183,9 +183,10 @@ __smpboot_create_thread(struct smp_hotplug_thread *ht, unsigned int cpu)
183 kfree(td); 183 kfree(td);
184 return PTR_ERR(tsk); 184 return PTR_ERR(tsk);
185 } 185 }
186
187 get_task_struct(tsk); 186 get_task_struct(tsk);
188 *per_cpu_ptr(ht->store, cpu) = tsk; 187 *per_cpu_ptr(ht->store, cpu) = tsk;
188 if (ht->create)
189 ht->create(cpu);
189 return 0; 190 return 0;
190} 191}
191 192
@@ -225,7 +226,7 @@ static void smpboot_park_thread(struct smp_hotplug_thread *ht, unsigned int cpu)
225{ 226{
226 struct task_struct *tsk = *per_cpu_ptr(ht->store, cpu); 227 struct task_struct *tsk = *per_cpu_ptr(ht->store, cpu);
227 228
228 if (tsk) 229 if (tsk && !ht->selfparking)
229 kthread_park(tsk); 230 kthread_park(tsk);
230} 231}
231 232