Implement a simplistic per-cpu maximum priority cpu monopolization
mechanism. A non-sleeping callback can be scheduled to run on one or
multiple cpus with maximum priority monopolozing those cpus. This is
primarily to replace and unify RT workqueue usage in stop_machine and
scheduler migration_thread which currently is serving multiple
Four functions are provided - stop_one_cpu(), stop_one_cpu_nowait(),
stop_cpus() and try_stop_cpus().
This is to allow clean sharing of resources among stop_cpu and all the
migration thread users. One stopper thread per cpu is created which
is currently named "stopper/CPU". This will eventually replace the
migration thread and take on its name.
* This facility was originally named cpuhog and lived in separate
files but Peter Zijlstra nacked the name and thus got renamed to
cpu_stop and moved into stop_machine.c.
* Better reporting of preemption leak as per Peter's suggestion.
Signed-off-by: Tejun Heo <firstname.lastname@example.org>
Cc: Oleg Nesterov <email@example.com>
Cc: Dimitri Sivanich <firstname.lastname@example.org>
Cc: Peter Zijlstra <email@example.com>
include/linux/stop_machine.h | 39 ++++-
kernel/stop_machine.c | 372 +++++++++++++++++++++++++++++++++++++++++-
2 files changed, 402 insertions(+), 9 deletions(-)
diff --git a/include/linux/stop_machine.h b/include/linux/stop_machine.h
index baba3a2..efcbd6c 100644
@@ -1,15 +1,46 @@
-/* "Bogolock": stop the entire machine, disable interrupts. This is a
- very heavy lock, which is equivalent to grabbing every spinlock
- (and more). So the "read" side to such a lock is anything which
- disables preeempt. */
#if defined(CONFIG_STOP_MACHINE) && defined(CONFIG_SMP)
+ * stop_cpu[s]() is simplistic per-cpu maximum priority ...