Skip to content

Commit a8897ed

Browse files
JakeHillionhtejun
authored andcommitted
sched_ext: create_dsq: Return -EEXIST on duplicate request
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 <[email protected]> Acked-by: Andrea Righi <[email protected]> Fixes: f0e1a06 ("sched_ext: Implement BPF extensible scheduler class") Cc: [email protected] # v6.12+ Signed-off-by: Tejun Heo <[email protected]>
1 parent 883cc35 commit a8897ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

kernel/sched/ext.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4171,8 +4171,8 @@ static struct scx_dispatch_q *create_dsq(u64 dsq_id, int node)
41714171

41724172
init_dsq(dsq, dsq_id);
41734173

4174-
ret = rhashtable_insert_fast(&dsq_hash, &dsq->hash_node,
4175-
dsq_hash_params);
4174+
ret = rhashtable_lookup_insert_fast(&dsq_hash, &dsq->hash_node,
4175+
dsq_hash_params);
41764176
if (ret) {
41774177
kfree(dsq);
41784178
return ERR_PTR(ret);

0 commit comments

Comments
 (0)