Re: [PATCH v2] sched_ext: Skip per-CPU data allocation for built-in DSQs
From: Zhan Xusheng
Date: Mon Aug 31 2026 - 22:29:17 EST
The v2 note says the waste is described as quadratic, but the changelog
still gives it per DSQ:
> Every DSQ still allocates nr_cpu_ids * sizeof(struct scx_dsq_pcpu)
> bytes of per-CPU memory for it.
Four of the five built-in ids come one per CPU: SCX_DSQ_BYPASS in the
for_each_possible_cpu() at ext.c:7173, SCX_DSQ_LOCAL and SCX_DSQ_REJECT in
the one at 8679, SCX_DSQ_RESCUE per rq in scx_rescue_init(). Only
SCX_DSQ_GLOBAL is per node. So the total is nr_cpu_ids squared, and a
reader of the changelog as it stands will work out a factor of nr_cpu_ids.
Worth spelling out, since that is where the saving is.
The code is right. scx_init_dsq() memsets the whole dsq first
(ext.c:5046) and sets lock, list, id and sched before the new early
return, so nothing a built-in id needs is skipped, and exit_dsq()'s
->pcpu_user test is the load-bearing kind: 7101, 5367 and 7334 all call it
with built-in DSQs. The only reader of the per-CPU data, ext.c:1130, was
already behind the !(dsq->id & SCX_DSQ_FLAG_BUILTIN) test above it.
Reviewed-by: Zhan Xusheng <zhanxusheng@xxxxxxxxxx>
Thanks,
Zhan Xusheng