* [PATCH sched_ext/for-6.18] sched_ext: Exit early on hotplug events during attach
@ 2025-09-04 5:57 Andrea Righi
2025-09-04 6:44 ` Tejun Heo
2025-10-13 18:41 ` Tejun Heo
0 siblings, 2 replies; 4+ messages in thread
From: Andrea Righi @ 2025-09-04 5:57 UTC (permalink / raw)
To: Tejun Heo, David Vernet, Changwoo Min; +Cc: sched-ext, linux-kernel
There is no need to complete the entire scx initialization if a
scheduler is failing to be attached due to a hotplug event.
Exit early to avoid unnecessary work and simplify the attach flow.
Signed-off-by: Andrea Righi <arighi@nvidia.com>
---
kernel/sched/ext.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/kernel/sched/ext.c b/kernel/sched/ext.c
index 9ddf7a145db6b..489462290142a 100644
--- a/kernel/sched/ext.c
+++ b/kernel/sched/ext.c
@@ -4445,7 +4445,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;
@@ -4462,8 +4462,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)
@@ -4560,7 +4563,11 @@ 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);
+ ret = check_hotplug_seq(sch, ops);
+ if (ret) {
+ cpus_read_unlock();
+ goto err_disable;
+ }
scx_idle_update_selcpu_topology(ops);
cpus_read_unlock();
--
2.51.0
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH sched_ext/for-6.18] sched_ext: Exit early on hotplug events during attach
2025-09-04 5:57 [PATCH sched_ext/for-6.18] sched_ext: Exit early on hotplug events during attach Andrea Righi
@ 2025-09-04 6:44 ` Tejun Heo
2025-10-13 18:41 ` Tejun Heo
1 sibling, 0 replies; 4+ messages in thread
From: Tejun Heo @ 2025-09-04 6:44 UTC (permalink / raw)
To: Andrea Righi; +Cc: David Vernet, Changwoo Min, sched-ext, linux-kernel
On Thu, Sep 04, 2025 at 07:57:16AM +0200, Andrea Righi wrote:
> There is no need to complete the entire scx initialization if a
> scheduler is failing to be attached due to a hotplug event.
>
> Exit early to avoid unnecessary work and simplify the attach flow.
>
> Signed-off-by: Andrea Righi <arighi@nvidia.com>
Applied to sched_ext/for-6.18.
Thanks.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH sched_ext/for-6.18] sched_ext: Exit early on hotplug events during attach
2025-09-04 5:57 [PATCH sched_ext/for-6.18] sched_ext: Exit early on hotplug events during attach Andrea Righi
2025-09-04 6:44 ` Tejun Heo
@ 2025-10-13 18:41 ` Tejun Heo
2025-10-13 19:37 ` Andrea Righi
1 sibling, 1 reply; 4+ messages in thread
From: Tejun Heo @ 2025-10-13 18:41 UTC (permalink / raw)
To: Andrea Righi; +Cc: David Vernet, Changwoo Min, sched-ext, linux-kernel
On Thu, Sep 04, 2025 at 07:57:16AM +0200, Andrea Righi wrote:
> There is no need to complete the entire scx initialization if a
> scheduler is failing to be attached due to a hotplug event.
>
> Exit early to avoid unnecessary work and simplify the attach flow.
>
> Signed-off-by: Andrea Righi <arighi@nvidia.com>
I applied this to the wrong branch and lost it in the pull request. Applying
again to for-6.19. Sorry.
--
tejun
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH sched_ext/for-6.18] sched_ext: Exit early on hotplug events during attach
2025-10-13 18:41 ` Tejun Heo
@ 2025-10-13 19:37 ` Andrea Righi
0 siblings, 0 replies; 4+ messages in thread
From: Andrea Righi @ 2025-10-13 19:37 UTC (permalink / raw)
To: Tejun Heo; +Cc: David Vernet, Changwoo Min, sched-ext, linux-kernel
On Mon, Oct 13, 2025 at 08:41:36AM -1000, Tejun Heo wrote:
> On Thu, Sep 04, 2025 at 07:57:16AM +0200, Andrea Righi wrote:
> > There is no need to complete the entire scx initialization if a
> > scheduler is failing to be attached due to a hotplug event.
> >
> > Exit early to avoid unnecessary work and simplify the attach flow.
> >
> > Signed-off-by: Andrea Righi <arighi@nvidia.com>
>
> I applied this to the wrong branch and lost it in the pull request. Applying
> again to for-6.19. Sorry.
Ok, thanks!
-Andrea
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2025-10-13 19:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-04 5:57 [PATCH sched_ext/for-6.18] sched_ext: Exit early on hotplug events during attach Andrea Righi
2025-09-04 6:44 ` Tejun Heo
2025-10-13 18:41 ` Tejun Heo
2025-10-13 19:37 ` Andrea Righi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox