mirror of https://github.com/torvalds/linux.git
sched_ext: Exit early on hotplug events during attach
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> Signed-off-by: Tejun Heo <tj@kernel.org>
This commit is contained in:
parent
14c1da3895
commit
0128c85051
|
|
@ -4513,7 +4513,7 @@ static struct scx_sched *scx_alloc_and_add_sched(struct sched_ext_ops *ops)
|
||||||
return ERR_PTR(ret);
|
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)
|
const struct sched_ext_ops *ops)
|
||||||
{
|
{
|
||||||
unsigned long long global_hotplug_seq;
|
unsigned long long global_hotplug_seq;
|
||||||
|
|
@ -4530,8 +4530,11 @@ static void check_hotplug_seq(struct scx_sched *sch,
|
||||||
SCX_ECODE_ACT_RESTART | SCX_ECODE_RSN_HOTPLUG,
|
SCX_ECODE_ACT_RESTART | SCX_ECODE_RSN_HOTPLUG,
|
||||||
"expected hotplug seq %llu did not match actual %llu",
|
"expected hotplug seq %llu did not match actual %llu",
|
||||||
ops->hotplug_seq, global_hotplug_seq);
|
ops->hotplug_seq, global_hotplug_seq);
|
||||||
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int validate_ops(struct scx_sched *sch, const struct sched_ext_ops *ops)
|
static int validate_ops(struct scx_sched *sch, const struct sched_ext_ops *ops)
|
||||||
|
|
@ -4633,7 +4636,11 @@ static int scx_enable(struct sched_ext_ops *ops, struct bpf_link *link)
|
||||||
if (((void (**)(void))ops)[i])
|
if (((void (**)(void))ops)[i])
|
||||||
set_bit(i, sch->has_op);
|
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);
|
scx_idle_update_selcpu_topology(ops);
|
||||||
|
|
||||||
cpus_read_unlock();
|
cpus_read_unlock();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue