[PATCH 3/4] sched/isolation: merge housekeeping_cpu() and housekeeping_test_cpu()
From: alexs
Date: Thu Apr 10 2025 - 05:28:45 EST
From: Alex Shi <alexs@xxxxxxxxxx>
Since the function just call housekeeping_test_cpu() without doing any other
things, we could just merge them together with name housekeeping_cpu();
Signed-off-by: Alex Shi <alexs@xxxxxxxxxx>
Cc: Frederic Weisbecker <frederic@xxxxxxxxxx>
Cc: Waiman Long <longman@xxxxxxxxxx>
Cc: Lai Jiangshan <jiangshanlai@xxxxxxxxx>
Cc: Tejun Heo <tj@xxxxxxxxxx>
Cc: Valentin Schneider <vschneid@xxxxxxxxxx>
Cc: Ben Segall <bsegall@xxxxxxxxxx>
Cc: Steven Rostedt <rostedt@xxxxxxxxxxx>
Cc: Dietmar Eggemann <dietmar.eggemann@xxxxxxx>
Cc: Vincent Guittot <vincent.guittot@xxxxxxxxxx>
Cc: Juri Lelli <juri.lelli@xxxxxxxxxx>
Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
---
include/linux/sched/isolation.h | 19 +++++++------------
kernel/sched/isolation.c | 4 ++--
kernel/workqueue.c | 2 +-
3 files changed, 10 insertions(+), 15 deletions(-)
diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index 231bc5766f76..90e46440fc85 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -30,7 +30,7 @@ extern int housekeeping_any_cpu(enum hk_type type);
extern const struct cpumask *housekeeping_cpumask(enum hk_type type);
extern bool housekeeping_enabled(enum hk_type type);
extern void housekeeping_affine(struct task_struct *t, enum hk_type type);
-extern bool housekeeping_test_cpu(int cpu, enum hk_type type);
+extern bool housekeeping_cpu(int cpu, enum hk_type type);
extern void __init housekeeping_init(void);
#else
@@ -50,26 +50,21 @@ static inline bool housekeeping_enabled(enum hk_type type)
return false;
}
-static inline void housekeeping_affine(struct task_struct *t,
- enum hk_type type) { }
-
-static inline bool housekeeping_test_cpu(int cpu, enum hk_type type)
+static inline bool housekeeping_cpu(int cpu, enum hk_type type)
{
return true;
}
+static inline void housekeeping_affine(struct task_struct *t,
+ enum hk_type type) { }
+
static inline void housekeeping_init(void) { }
#endif /* CONFIG_CPU_ISOLATION */
-static inline bool housekeeping_cpu(int cpu, enum hk_type type)
-{
- return housekeeping_test_cpu(cpu, type);
-}
-
static inline bool cpu_is_isolated(int cpu)
{
- return !housekeeping_test_cpu(cpu, HK_TYPE_DOMAIN) ||
- !housekeeping_test_cpu(cpu, HK_TYPE_TICK) ||
+ return !housekeeping_cpu(cpu, HK_TYPE_DOMAIN) ||
+ !housekeeping_cpu(cpu, HK_TYPE_TICK) ||
cpuset_cpu_is_isolated(cpu);
}
diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
index 81bc8b329ef1..e93776740725 100644
--- a/kernel/sched/isolation.c
+++ b/kernel/sched/isolation.c
@@ -73,14 +73,14 @@ void housekeeping_affine(struct task_struct *t, enum hk_type type)
}
EXPORT_SYMBOL_GPL(housekeeping_affine);
-bool housekeeping_test_cpu(int cpu, enum hk_type type)
+bool housekeeping_cpu(int cpu, enum hk_type type)
{
if (static_branch_unlikely(&housekeeping_overridden))
if (housekeeping.flags & BIT(type))
return cpumask_test_cpu(cpu, housekeeping.cpumasks[type]);
return true;
}
-EXPORT_SYMBOL_GPL(housekeeping_test_cpu);
+EXPORT_SYMBOL_GPL(housekeeping_cpu);
void __init housekeeping_init(void)
{
diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index bfe030b443e2..69a02c9e53fb 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -2518,7 +2518,7 @@ static void __queue_delayed_work(int cpu, struct workqueue_struct *wq,
if (housekeeping_enabled(HK_TYPE_TIMER)) {
/* If the current cpu is a housekeeping cpu, use it. */
cpu = smp_processor_id();
- if (!housekeeping_test_cpu(cpu, HK_TYPE_TIMER))
+ if (!housekeeping_cpu(cpu, HK_TYPE_TIMER))
cpu = housekeeping_any_cpu(HK_TYPE_TIMER);
add_timer_on(timer, cpu);
} else {
--
2.47.1