Arvind M | 8e87d85 | 2018-01-29 00:04:29 -0800 | [diff] [blame] | 1 | From 6e58d6c97bc8a170f5f3fb35954a765623f3817c Mon Sep 17 00:00:00 2001 |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 2 | From: Thomas Gleixner <tglx@linutronix.de> |
| 3 | Date: Sun, 17 Jul 2011 19:35:29 +0200 |
Arvind M | 10268e7 | 2017-12-04 22:18:06 -0800 | [diff] [blame] | 4 | Subject: [PATCH 105/366] hotplug: Use migrate disable on unplug |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 5 | |
| 6 | Migration needs to be disabled accross the unplug handling to make |
| 7 | sure that the unplug thread is off the unplugged cpu. |
| 8 | |
| 9 | Signed-off-by: Thomas Gleixner <tglx@linutronix.de> |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 10 | --- |
| 11 | kernel/cpu.c | 6 +++--- |
| 12 | 1 file changed, 3 insertions(+), 3 deletions(-) |
| 13 | |
| 14 | diff --git a/kernel/cpu.c b/kernel/cpu.c |
Ishan Mittal | b799826 | 2017-01-17 16:11:50 +0530 | [diff] [blame] | 15 | index 04df252..494b606 100644 |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 16 | --- a/kernel/cpu.c |
| 17 | +++ b/kernel/cpu.c |
| 18 | @@ -457,14 +457,13 @@ static int _cpu_down(unsigned int cpu, int tasks_frozen) |
| 19 | cpumask_andnot(cpumask, cpu_online_mask, cpumask_of(cpu)); |
| 20 | set_cpus_allowed_ptr(current, cpumask); |
| 21 | free_cpumask_var(cpumask); |
| 22 | - preempt_disable(); |
| 23 | + migrate_disable(); |
| 24 | mycpu = smp_processor_id(); |
| 25 | if (mycpu == cpu) { |
| 26 | printk(KERN_ERR "Yuck! Still on unplug CPU\n!"); |
| 27 | - preempt_enable(); |
| 28 | + migrate_enable(); |
| 29 | return -EBUSY; |
| 30 | } |
| 31 | - preempt_enable(); |
| 32 | |
| 33 | cpu_hotplug_begin(); |
| 34 | err = cpu_unplug_begin(cpu); |
Ishan Mittal | b799826 | 2017-01-17 16:11:50 +0530 | [diff] [blame] | 35 | @@ -546,6 +545,7 @@ static int _cpu_down(unsigned int cpu, int tasks_frozen) |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 36 | out_release: |
| 37 | cpu_unplug_done(cpu); |
| 38 | out_cancel: |
| 39 | + migrate_enable(); |
| 40 | cpu_hotplug_done(); |
| 41 | trace_sched_cpu_hotplug(cpu, err, 0); |
| 42 | if (!err) |
| 43 | -- |
Arvind M | 10268e7 | 2017-12-04 22:18:06 -0800 | [diff] [blame] | 44 | 1.9.1 |
Allen Martin | 685e0f8 | 2016-07-26 19:34:29 -0700 | [diff] [blame] | 45 | |