[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241220154107.287478-9-arighi@nvidia.com>
Date: Fri, 20 Dec 2024 16:11:40 +0100
From: Andrea Righi <arighi@...dia.com>
To: Tejun Heo <tj@...nel.org>,
David Vernet <void@...ifault.com>,
Changwoo Min <changwoo@...lia.com>
Cc: Yury Norov <yury.norov@...il.com>,
Ingo Molnar <mingo@...hat.com>,
Peter Zijlstra <peterz@...radead.org>,
Juri Lelli <juri.lelli@...hat.com>,
Vincent Guittot <vincent.guittot@...aro.org>,
Dietmar Eggemann <dietmar.eggemann@....com>,
Steven Rostedt <rostedt@...dmis.org>,
Ben Segall <bsegall@...gle.com>,
Mel Gorman <mgorman@...e.de>,
Valentin Schneider <vschneid@...hat.com>,
bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 08/10] sched_ext: idle: introduce SCX_PICK_IDLE_NODE
Introduce a flag to restrict the selection of an idle CPU to a specific
NUMA node.
Signed-off-by: Andrea Righi <arighi@...dia.com>
---
kernel/sched/ext.c | 1 +
kernel/sched/ext_idle.c | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 143938e935f1..da5c15bd3c56 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -773,6 +773,7 @@ enum scx_deq_flags {
enum scx_pick_idle_cpu_flags {
SCX_PICK_IDLE_CORE = 1LLU << 0, /* pick a CPU whose SMT siblings are also idle */
+ SCX_PICK_IDLE_NODE = 1LLU << 1, /* pick a CPU in the same target NUMA node */
};
enum scx_kick_flags {
diff --git a/kernel/sched/ext_idle.c b/kernel/sched/ext_idle.c
index 444f2a15f1d4..013deaa08f12 100644
--- a/kernel/sched/ext_idle.c
+++ b/kernel/sched/ext_idle.c
@@ -199,6 +199,12 @@ static s32 scx_pick_idle_cpu(const struct cpumask *cpus_allowed, int node, u64 f
cpu = pick_idle_cpu_from_node(cpus_allowed, n, flags);
if (cpu >= 0)
break;
+ /*
+ * Check if the search is restricted to the same core or
+ * the same node.
+ */
+ if (flags & SCX_PICK_IDLE_NODE)
+ break;
}
return cpu;
@@ -495,7 +501,8 @@ static s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu,
* Search for any fully idle core in the same LLC domain.
*/
if (llc_cpus) {
- cpu = pick_idle_cpu_from_node(llc_cpus, node, SCX_PICK_IDLE_CORE);
+ cpu = scx_pick_idle_cpu(llc_cpus, node,
+ SCX_PICK_IDLE_CORE | SCX_PICK_IDLE_NODE);
if (cpu >= 0)
goto cpu_found;
}
@@ -533,7 +540,7 @@ static s32 scx_select_cpu_dfl(struct task_struct *p, s32 prev_cpu,
* Search for any idle CPU in the same LLC domain.
*/
if (llc_cpus) {
- cpu = pick_idle_cpu_from_node(llc_cpus, node, 0);
+ cpu = scx_pick_idle_cpu(llc_cpus, node, SCX_PICK_IDLE_NODE);
if (cpu >= 0)
goto cpu_found;
}
--
2.47.1
Powered by blists - more mailing lists