[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250903095008.162049-2-arighi@nvidia.com>
Date: Wed, 3 Sep 2025 11:33:27 +0200
From: Andrea Righi <arighi@...dia.com>
To: 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>,
Joel Fernandes <joelagnelf@...dia.com>,
Tejun Heo <tj@...nel.org>,
David Vernet <void@...ifault.com>,
Changwoo Min <changwoo@...lia.com>,
Shuah Khan <shuah@...nel.org>
Cc: sched-ext@...ts.linux.dev,
bpf@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: [PATCH 01/16] sched_ext: Exit early on hotplug events during attach
There is no need to complete the scx initialization if the current
scheduler is failing to be attached due to a hotplug event.
Signed-off-by: Andrea Righi <arighi@...dia.com>
---
kernel/sched/ext.c | 13 ++++++++++---
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 7dedc9a16281b..63d9273278e5e 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -5512,7 +5512,7 @@ static struct scx_sched *scx_alloc_and_add_sched(struct sched_ext_ops *ops)
return ERR_PTR(ret);
}
-static void check_hotplug_seq(struct scx_sched *sch,
+static int check_hotplug_seq(struct scx_sched *sch,
const struct sched_ext_ops *ops)
{
unsigned long long global_hotplug_seq;
@@ -5529,8 +5529,11 @@ static void check_hotplug_seq(struct scx_sched *sch,
SCX_ECODE_ACT_RESTART | SCX_ECODE_RSN_HOTPLUG,
"expected hotplug seq %llu did not match actual %llu",
ops->hotplug_seq, global_hotplug_seq);
+ return -EBUSY;
}
}
+
+ return 0;
}
static int validate_ops(struct scx_sched *sch, const struct sched_ext_ops *ops)
@@ -5627,11 +5630,15 @@ static int scx_enable(struct sched_ext_ops *ops, struct bpf_link *link)
if (((void (**)(void))ops)[i])
set_bit(i, sch->has_op);
- check_hotplug_seq(sch, ops);
- scx_idle_update_selcpu_topology(ops);
+ ret = check_hotplug_seq(sch, ops);
+ if (!ret)
+ scx_idle_update_selcpu_topology(ops);
cpus_read_unlock();
+ if (ret)
+ goto err_disable;
+
ret = validate_ops(sch, ops);
if (ret)
goto err_disable;
--
2.51.0
Powered by blists - more mailing lists