Skip to content

Commit 38ef046

Browse files
committed
Merge tag 'sched_ext-for-6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext
Pull sched_ext updates from Tejun Heo: - Move C example schedulers back from the external scx repo to tools/sched_ext as the authoritative source. scx_userland and scx_pair are returning while scx_sdt (BPF arena-based task data management) is new. These schedulers will be dropped from the external repo. - Improve error reporting by adding scx_bpf_error() calls when DSQ creation fails across all in-tree schedulers - Avoid redundant irq_work_queue() calls in destroy_dsq() by only queueing when llist_add() indicates an empty list - Fix flaky init_enable_count selftest by properly synchronizing pre-forked children using a pipe instead of sleep() * tag 'sched_ext-for-6.20' of git://git.kernel.org/pub/scm/linux/kernel/git/tj/sched_ext: selftests/sched_ext: Fix init_enable_count flakiness tools/sched_ext: Fix data header access during free in scx_sdt tools/sched_ext: Add error logging for dsq creation failures in remaining schedulers tools/sched_ext: add arena based scheduler tools/sched_ext: add scx_pair scheduler tools/sched_ext: add scx_userland scheduler sched_ext: Add error logging for dsq creation failures sched_ext: Avoid multiple irq_work_queue() calls in destroy_dsq()
2 parents ff661ee + 4544e9c commit 38ef046

17 files changed

Lines changed: 2592 additions & 21 deletions

kernel/sched/ext.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3520,8 +3520,8 @@ static void destroy_dsq(struct scx_sched *sch, u64 dsq_id)
35203520
* operations inside scheduler locks.
35213521
*/
35223522
dsq->id = SCX_DSQ_INVALID;
3523-
llist_add(&dsq->free_node, &dsqs_to_free);
3524-
irq_work_queue(&free_dsq_irq_work);
3523+
if (llist_add(&dsq->free_node, &dsqs_to_free))
3524+
irq_work_queue(&free_dsq_irq_work);
35253525

35263526
out_unlock_dsq:
35273527
raw_spin_unlock_irqrestore(&dsq->lock, flags);

tools/sched_ext/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ $(INCLUDE_DIR)/%.bpf.skel.h: $(SCXOBJ_DIR)/%.bpf.o $(INCLUDE_DIR)/vmlinux.h $(BP
189189

190190
SCX_COMMON_DEPS := include/scx/common.h include/scx/user_exit_info.h | $(BINDIR)
191191

192-
c-sched-targets = scx_simple scx_cpu0 scx_qmap scx_central scx_flatcg
192+
c-sched-targets = scx_simple scx_cpu0 scx_qmap scx_central scx_flatcg scx_userland scx_pair scx_sdt
193193

194194
$(addprefix $(BINDIR)/,$(c-sched-targets)): \
195195
$(BINDIR)/%: \

tools/sched_ext/scx_central.bpf.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,10 @@ int BPF_STRUCT_OPS_SLEEPABLE(central_init)
301301
int ret;
302302

303303
ret = scx_bpf_create_dsq(FALLBACK_DSQ_ID, -1);
304-
if (ret)
304+
if (ret) {
305+
scx_bpf_error("scx_bpf_create_dsq failed (%d)", ret);
305306
return ret;
307+
}
306308

307309
timer = bpf_map_lookup_elem(&central_timer, &key);
308310
if (!timer)

tools/sched_ext/scx_cpu0.bpf.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,15 @@ void BPF_STRUCT_OPS(cpu0_dispatch, s32 cpu, struct task_struct *prev)
7171

7272
s32 BPF_STRUCT_OPS_SLEEPABLE(cpu0_init)
7373
{
74-
return scx_bpf_create_dsq(DSQ_CPU0, -1);
74+
int ret;
75+
76+
ret = scx_bpf_create_dsq(DSQ_CPU0, -1);
77+
if (ret) {
78+
scx_bpf_error("failed to create DSQ %d (%d)", DSQ_CPU0, ret);
79+
return ret;
80+
}
81+
82+
return 0;
7583
}
7684

7785
void BPF_STRUCT_OPS(cpu0_exit, struct scx_exit_info *ei)

tools/sched_ext/scx_flatcg.bpf.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -842,8 +842,10 @@ int BPF_STRUCT_OPS_SLEEPABLE(fcg_cgroup_init, struct cgroup *cgrp,
842842
* unlikely case that it breaks.
843843
*/
844844
ret = scx_bpf_create_dsq(cgid, -1);
845-
if (ret)
845+
if (ret) {
846+
scx_bpf_error("scx_bpf_create_dsq failed (%d)", ret);
846847
return ret;
848+
}
847849

848850
cgc = bpf_cgrp_storage_get(&cgrp_ctx, cgrp, 0,
849851
BPF_LOCAL_STORAGE_GET_F_CREATE);
@@ -927,7 +929,15 @@ void BPF_STRUCT_OPS(fcg_cgroup_move, struct task_struct *p,
927929

928930
s32 BPF_STRUCT_OPS_SLEEPABLE(fcg_init)
929931
{
930-
return scx_bpf_create_dsq(FALLBACK_DSQ, -1);
932+
int ret;
933+
934+
ret = scx_bpf_create_dsq(FALLBACK_DSQ, -1);
935+
if (ret) {
936+
scx_bpf_error("failed to create DSQ %d (%d)", FALLBACK_DSQ, ret);
937+
return ret;
938+
}
939+
940+
return 0;
931941
}
932942

933943
void BPF_STRUCT_OPS(fcg_exit, struct scx_exit_info *ei)

0 commit comments

Comments
 (0)