Messages in this thread Patch in this message | | | From | Paul Gortmaker <> | Subject | [PATCH 1/2] sched: isolation: cpu isolation handles for cpuset | Date | Wed, 27 Oct 2021 16:43:18 -0400 |
| |
Assuming we want to drive isolation from cpuset and not something like /sys/devices/system/cpu/cpu*/hotplug/isolation then we'll need some kind of handle for cpuset to drive it from.
These would also serve as a collection point for all the isolation related operations - current and future. While only RCU nocb toggle is currently deployed, I've left some guesses at what is probably to come in the future.
Cc: Ingo Molnar <mingo@redhat.com> Cc: Steven Rostedt <rostedt@goodmis.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Josh Triplett <josh@joshtriplett.org> Cc: Paul E. McKenney <paulmck@kernel.org> Cc: Frederic Weisbecker <frederic@kernel.org> Cc: Valentin Schneider <valentin.schneider@arm.com> [PG: RFC code - not for merge] Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com> --- include/linux/sched/isolation.h | 4 ++++ kernel/sched/isolation.c | 22 ++++++++++++++++++++++ 2 files changed, 26 insertions(+)
diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h index cc9f393e2a70..3ab9c667c441 100644 --- a/include/linux/sched/isolation.h +++ b/include/linux/sched/isolation.h @@ -25,6 +25,8 @@ extern bool housekeeping_enabled(enum hk_flags flags); extern void housekeeping_affine(struct task_struct *t, enum hk_flags flags); extern bool housekeeping_test_cpu(int cpu, enum hk_flags flags); extern void __init housekeeping_init(void); +extern void isolate_cpu(int cpu); +extern void deisolate_cpu(int cpu); #else @@ -46,6 +48,8 @@ static inline bool housekeeping_enabled(enum hk_flags flags) static inline void housekeeping_affine(struct task_struct *t, enum hk_flags flags) { } static inline void housekeeping_init(void) { } +static void isolate_cpu(int cpu) { } +static void deisolate_cpu(int cpu) { } #endif /* CONFIG_CPU_ISOLATION */ static inline bool housekeeping_cpu(int cpu, enum hk_flags flags) diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c index 7f06eaf12818..57b105d42632 100644 --- a/kernel/sched/isolation.c +++ b/kernel/sched/isolation.c @@ -63,6 +63,28 @@ bool housekeeping_test_cpu(int cpu, enum hk_flags flags) } EXPORT_SYMBOL_GPL(housekeeping_test_cpu); +void isolate_cpu(int cpu) +{ + pr_info("Isolating core %d\n", cpu); + if (rcu_nocb_cpu_offload(cpu)) + pr_warn("RCU; unable to nocb offload CPU %d\n", cpu); +#if 0 /* TODO */ + housekeeping_clear_cpu(cpu); + tick_nohz_full_add_cpus_to(cpumask_of(cpu)); +#endif +} + +void deisolate_cpu(int cpu) +{ + pr_info("Deisolating core %d\n", cpu); +#if 0 /* TODO */ + tick_nohz_full_clear_cpus_from(cpumask_of(cpu)); + housekeeping_add_cpu(cpu); +#endif + if (rcu_nocb_cpu_deoffload(cpu)) + pr_warn("RCU: unable to nocb reload CPU %d\n", cpu); +} + void __init housekeeping_init(void) { if (!housekeeping_flags) -- 2.15.0
| |