Re: [PATCH 8/9] tools/sched_ext: scx_userland: Check dispatch buffer slots before inserting
From: bot+bpf-ci
Date: Wed Nov 11 2026 - 16:12:03 EST
> tools/sched_ext: scx_userland: Check dispatch buffer slots before inserting
TL;DR: Commit message only: the sentence explaining when the dispatch buffer
overflows is garbled (two sentences run together, stray indent); the review
asks for a rewrite. No code issues raised.
> tools/sched_ext: scx_userland: Check dispatch buffer slots before inserting
>
> userland_dispatch() pops up to MAX_ENQUEUED_TASKS pids from the
> dispatched map and inserts each task into the global DSQ without
> consulting scx_bpf_dispatch_nr_slots(). The kernel's dispatch buffer
> holds 32 slots against MAX_ENQUEUED_TASKS (4096), so a single
> full dispatch round overflows it long before that many tasks
> pile up between dispatch rounds the insert past the buffer limit aborts
> the whole scheduler. Every other tools scheduler that loops on
> scx_bpf_dsq_insert() (scx_central, scx_qmap) checks the remaining slot
> count; scx_userland is the odd one out.
>
> Break out when the buffer is exhausted and leave the remaining tasks
> queued for the next dispatch round.
>
> Fixes: cc4448d0856d ("tools/sched_ext: add scx_userland scheduler")
> Signed-off-by: Tao Cui <cuitao@xxxxxxxxxx>
This isn't a bug, but the sentence explaining when the overflow happens
looks garbled. It reads as two sentences run together:
"so a single
full dispatch round overflows it long before that many tasks
pile up between dispatch rounds the insert past the buffer limit aborts
the whole scheduler."
The second line also has a stray three-space indent.
>From the code, userland_dispatch() pops pids from the dispatched queue and
calls scx_bpf_dsq_insert() for each one. Each insert from ops.dispatch()
goes through scx_dsq_insert_commit(), which calls
scx_error(sch, "dispatch buffer overflow") once
dspc->cursor >= sch->dsp_max_batch. Since scx_userland does not set
ops.dispatch_max_batch, dsp_max_batch is SCX_DSP_DFL_MAX_BATCH (32).
So the scheduler aborts once more than 32 pids (31 if
dispatch_user_scheduler() also inserted the usersched task in the same
call) have built up in the dispatched queue between two ops.dispatch()
calls.
Could the sentence be rewritten to say that directly?
---
AI reviewed your patch. Please fix the bug or email reply why it's not a bug.
See: https://github.com/kernel-patches/vmtest/blob/master/ci/claude/README.md
CI run summary: https://github.com/kernel-patches/bpf/actions/runs/43092548483