Skip to content

Commit bd4f082

Browse files
soolaugusthtejun
authored andcommitted
tools/sched_ext: Add error logging for dsq creation failures in remaining schedulers
Add scx_bpf_error() calls when scx_bpf_create_dsq() fails in the remaining schedulers to improve debuggability: - scx_simple.bpf.c: simple_init() - scx_sdt.bpf.c: sdt_init() - scx_cpu0.bpf.c: cpu0_init() - scx_flatcg.bpf.c: fcg_init() This follows the same pattern established in commit 2f8d489 ("sched_ext: Add error logging for dsq creation failures") for other schedulers and ensures consistent error reporting across all schedulers. Signed-off-by: zhidao su <suzhidao@xiaomi.com> Signed-off-by: Tejun Heo <tj@kernel.org>
1 parent 36929eb commit bd4f082

4 files changed

Lines changed: 34 additions & 4 deletions

File tree

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: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -929,7 +929,15 @@ void BPF_STRUCT_OPS(fcg_cgroup_move, struct task_struct *p,
929929

930930
s32 BPF_STRUCT_OPS_SLEEPABLE(fcg_init)
931931
{
932-
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;
933941
}
934942

935943
void BPF_STRUCT_OPS(fcg_exit, struct scx_exit_info *ei)

tools/sched_ext/scx_sdt.bpf.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -691,7 +691,13 @@ s32 BPF_STRUCT_OPS_SLEEPABLE(sdt_init)
691691
return ret;
692692
}
693693

694-
return scx_bpf_create_dsq(SHARED_DSQ, -1);
694+
ret = scx_bpf_create_dsq(SHARED_DSQ, -1);
695+
if (ret) {
696+
scx_bpf_error("failed to create DSQ %d (%d)", SHARED_DSQ, ret);
697+
return ret;
698+
}
699+
700+
return 0;
695701
}
696702

697703
void BPF_STRUCT_OPS(sdt_exit, struct scx_exit_info *ei)

tools/sched_ext/scx_simple.bpf.c

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,15 @@ void BPF_STRUCT_OPS(simple_enable, struct task_struct *p)
131131

132132
s32 BPF_STRUCT_OPS_SLEEPABLE(simple_init)
133133
{
134-
return scx_bpf_create_dsq(SHARED_DSQ, -1);
134+
int ret;
135+
136+
ret = scx_bpf_create_dsq(SHARED_DSQ, -1);
137+
if (ret) {
138+
scx_bpf_error("failed to create DSQ %d (%d)", SHARED_DSQ, ret);
139+
return ret;
140+
}
141+
142+
return 0;
135143
}
136144

137145
void BPF_STRUCT_OPS(simple_exit, struct scx_exit_info *ei)

0 commit comments

Comments
 (0)