Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit cc1fe215 authored by Thomas Gleixner's avatar Thomas Gleixner
Browse files

cpu/hotplug: Split do_cpu_down()



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: default avatarThomas Gleixner <tglx@linutronix.de>
Reviewed-by: default avatarKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Acked-by: default avatarIngo Molnar <mingo@kernel.org>
parent c4de6569
Loading
Loading
Loading
Loading
+8 −9
Original line number Diff line number Diff line
@@ -906,20 +906,19 @@ static int __ref _cpu_down(unsigned int cpu, int tasks_frozen,
	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;
}