[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230317134448.11082-2-mhocko@kernel.org>
Date: Fri, 17 Mar 2023 14:44:47 +0100
From: Michal Hocko <mhocko@...nel.org>
To: Andrew Morton <akpm@...ux-foundation.org>,
Leonardo Bras <leobras@...hat.com>
Cc: Frederic Weisbecker <fweisbecker@...e.de>,
Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Marcelo Tosatti <mtosatti@...hat.com>,
Johannes Weiner <hannes@...xchg.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
Shakeel Butt <shakeelb@...gle.com>,
Muchun Song <muchun.song@...ux.dev>,
LKML <linux-kernel@...r.kernel.org>, <linux-mm@...ck.org>,
Frederic Weisbecker <frederic@...nel.org>,
Michal Hocko <mhocko@...e.com>
Subject: [PATCH 1/2] sched/isolation: Add cpu_is_isolated() API
From: Frederic Weisbecker <frederic@...nel.org>
Provide this new API to check if a CPU has been isolated either through
isolcpus= or nohz_full= kernel parameter.
It aims at avoiding kernel load deemed to be safely spared on CPUs
running sensitive workload that can't bear any disturbance, such as
pcp cache draining.
Suggested-by: Michal Hocko <mhocko@...e.com>
Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
Signed-off-by: Michal Hocko <mhocko@...e.com>
---
include/linux/sched/isolation.h | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/include/linux/sched/isolation.h b/include/linux/sched/isolation.h
index 8c15abd67aed..fe1a46f30d24 100644
--- a/include/linux/sched/isolation.h
+++ b/include/linux/sched/isolation.h
@@ -46,6 +46,12 @@ static inline bool housekeeping_enabled(enum hk_type type)
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)
+{
+ return true;
+}
+
static inline void housekeeping_init(void) { }
#endif /* CONFIG_CPU_ISOLATION */
@@ -58,4 +64,10 @@ static inline bool housekeeping_cpu(int cpu, enum hk_type type)
return true;
}
+static inline bool cpu_is_isolated(int cpu)
+{
+ return !housekeeping_test_cpu(cpu, HK_TYPE_DOMAIN) ||
+ !housekeeping_test_cpu(cpu, HK_TYPE_TICK);
+}
+
#endif /* _LINUX_SCHED_ISOLATION_H */
--
2.30.2
Powered by blists - more mailing lists