From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: <linux-kernel@vger.kernel.org>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>,
Ingo Molnar <mingo@redhat.com>,
Steven Rostedt <rostedt@goodmis.org>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Josh Triplett <josh@joshtriplett.org>,
"Paul E . McKenney" <paulmck@kernel.org>,
"Frederic Weisbecker" <frederic@kernel.org>,
Valentin Schneider <valentin.schneider@arm.com>
Subject: [PATCH 1/2] sched: isolation: cpu isolation handles for cpuset
Date: Wed, 27 Oct 2021 16:43:18 -0400 [thread overview]
Message-ID: <20211027204319.22697-2-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <20211027204319.22697-1-paul.gortmaker@windriver.com>
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
next prev parent reply other threads:[~2021-10-27 21:41 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-27 20:43 [PATCH 0/2] bind rcu offload (nohz_full/isolation) into cpuset Paul Gortmaker
2021-10-27 20:43 ` Paul Gortmaker [this message]
2021-10-27 23:20 ` [PATCH 1/2] sched: isolation: cpu isolation handles for cpuset Frederic Weisbecker
2021-10-27 20:43 ` [PATCH 2/2] cpuset: add binding to CPU isolation Paul Gortmaker
2021-10-27 23:12 ` [PATCH 0/2] bind rcu offload (nohz_full/isolation) into cpuset Frederic Weisbecker
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211027204319.22697-2-paul.gortmaker@windriver.com \
--to=paul.gortmaker@windriver.com \
--cc=frederic@kernel.org \
--cc=josh@joshtriplett.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=paulmck@kernel.org \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=tglx@linutronix.de \
--cc=valentin.schneider@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox