]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
sched_ext: create_dsq: Return -EEXIST on duplicate request
authorJake Hillion <jake@hillion.co.uk>
Tue, 25 Mar 2025 22:41:52 +0000 (22:41 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Apr 2025 08:18:27 +0000 (10:18 +0200)
commitf2a2155d95556da602fe1857fdf39350de65e6a5
tree9960f40642441ae063191bdd54bd65803abef483
parent6fdf0854c358414bec1ce03cbf34f47cc3f8d32a
sched_ext: create_dsq: Return -EEXIST on duplicate request

commit a8897ed8523d4c9d782e282b18005a3779c92714 upstream.

create_dsq and therefore the scx_bpf_create_dsq kfunc currently silently
ignore duplicate entries. As a sched_ext scheduler is creating each DSQ
for a different purpose this is surprising behaviour.

Replace rhashtable_insert_fast which ignores duplicates with
rhashtable_lookup_insert_fast that reports duplicates (though doesn't
return their value). The rest of the code is structured correctly and
this now returns -EEXIST.

Tested by adding an extra scx_bpf_create_dsq to scx_simple. Previously
this was ignored, now init fails with a -17 code. Also ran scx_lavd
which continued to work well.

Signed-off-by: Jake Hillion <jake@hillion.co.uk>
Acked-by: Andrea Righi <arighi@nvidia.com>
Fixes: f0e1a0643a59 ("sched_ext: Implement BPF extensible scheduler class")
Cc: stable@vger.kernel.org # v6.12+
Signed-off-by: Tejun Heo <tj@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
kernel/sched/ext.c