OSDN Git Service

cpu/hotplug: Split do_cpu_down()
authorThomas Gleixner <tglx@linutronix.de>
Tue, 29 May 2018 15:49:05 +0000 (17:49 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Thu, 21 Jun 2018 12:20:57 +0000 (14:20 +0200)
Split out the inner workings of do_cpu_down() to allow reuse of that
function for the upcoming SMT disabling mechanism.

No functional change.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: Ingo Molnar <mingo@kernel.org>
kernel/cpu.c

index 61396b3..e266cb5 100644 (file)
@@ -906,20 +906,19 @@ out:
        return ret;
 }
 
+static int cpu_down_maps_locked(unsigned int cpu, enum cpuhp_state target)
+{
+       if (cpu_hotplug_disabled)
+               return -EBUSY;
+       return _cpu_down(cpu, 0, target);
+}
+
 static int do_cpu_down(unsigned int cpu, enum cpuhp_state target)
 {
        int err;
 
        cpu_maps_update_begin();
-
-       if (cpu_hotplug_disabled) {
-               err = -EBUSY;
-               goto out;
-       }
-
-       err = _cpu_down(cpu, 0, target);
-
-out:
+       err = cpu_down_maps_locked(cpu, target);
        cpu_maps_update_done();
        return err;
 }