[PATCH 2/7] sched/isolation: Move HK_TYPE_SCHED to housekeeping runtime

Pierre Gondois posted 7 patches 1 year, 10 months ago
[PATCH 2/7] sched/isolation: Move HK_TYPE_SCHED to housekeeping runtime
Posted by Pierre Gondois 1 year, 10 months ago
The HK_TYPE_SCHED isolation mask is never modified. It is however
referenced in the scheduler code to ignore CPUs not taking part in
load balancing for instance.

Move the HK_TYPE_SCHED to the newly created housekeeping runtime
type. Places where HK_TYPE_SCHED is used are not impacted as:
- the HKR_FLAG_SCHED flag isn't used by the isolcpus/nohz_full
  kernel parameters
- masks not set though kernel parameters default to the
  cpu_online_mask

Signed-off-by: Pierre Gondois <pierre.gondois@arm.com>
---
 include/linux/sched/isolation.h | 2 +-
 kernel/sched/fair.c             | 4 ++--
 kernel/sched/isolation.c        | 5 ++++-
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index 5d2f40c6f04c..80b4e26a1b73 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -7,6 +7,7 @@
 #include <linux/tick.h>
 
 enum hkr_type {
+	HKR_TYPE_SCHED,
 	HKR_TYPE_MAX
 };
 
@@ -14,7 +15,6 @@ enum hk_type {
 	HK_TYPE_TIMER,
 	HK_TYPE_RCU,
 	HK_TYPE_MISC,
-	HK_TYPE_SCHED,
 	HK_TYPE_TICK,
 	HK_TYPE_DOMAIN,
 	HK_TYPE_WQ,
diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
index 1dd37168da50..e3d707243ca7 100644
--- a/kernel/sched/fair.c
+++ b/kernel/sched/fair.c
@@ -12083,7 +12083,7 @@ void nohz_balance_enter_idle(int cpu)
 		return;
 
 	/* Spare idle load balancing on CPUs that don't want to be disturbed: */
-	if (!housekeeping_cpu(cpu, HK_TYPE_SCHED))
+	if (!housekeeping_runtime_test_cpu(cpu, HKR_TYPE_SCHED))
 		return;
 
 	/*
@@ -12309,7 +12309,7 @@ static void nohz_newidle_balance(struct rq *this_rq)
 	 * This CPU doesn't want to be disturbed by scheduler
 	 * housekeeping
 	 */
-	if (!housekeeping_cpu(this_cpu, HK_TYPE_SCHED))
+	if (!housekeeping_runtime_test_cpu(this_cpu, HKR_TYPE_SCHED))
 		return;
 
 	/* Will wake up very soon. No time for doing anything else*/
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index 5acbed870c28..735925578815 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -8,11 +8,14 @@
  *
  */
 
+enum hk_runtime_flags {
+	HKR_FLAG_SCHED		= BIT(HKR_TYPE_SCHED),
+};
+
 enum hk_flags {
 	HK_FLAG_TIMER		= BIT(HK_TYPE_TIMER),
 	HK_FLAG_RCU		= BIT(HK_TYPE_RCU),
 	HK_FLAG_MISC		= BIT(HK_TYPE_MISC),
-	HK_FLAG_SCHED		= BIT(HK_TYPE_SCHED),
 	HK_FLAG_TICK		= BIT(HK_TYPE_TICK),
 	HK_FLAG_DOMAIN		= BIT(HK_TYPE_DOMAIN),
 	HK_FLAG_WQ		= BIT(HK_TYPE_WQ),
-- 
2.25.1