From: Zhan Xusheng <zhanxusheng1024@gmail.com>
To: fangqiurong@kylinos.cn
Cc: tj@kernel.org, void@manifault.com, arighi@nvidia.com,
changwoo@igalia.com, sched-ext@lists.linux.dev,
linux-kernel@vger.kernel.org, zhanxusheng@xiaomi.com
Subject: Re: [PATCH] sched_ext: Skip per-CPU data allocation for built-in DSQs
Date: Thu, 27 Aug 2026 17:38:38 +0800 [thread overview]
Message-ID: <20260827093838.532352-1-zhanxusheng1024@gmail.com> (raw)
In-Reply-To: <20260827082329.3368255-1-fangqiurong@kylinos.cn>
From: Zhan Xusheng <zhanxusheng@xiaomi.com>
On Thu, 27 Aug 2026 16:23:29 +0800, Qiurong Fang wrote:
> Every built-in DSQ still carries nr_cpu_ids * sizeof(struct
> scx_dsq_pcpu) bytes of dead per-CPU memory.
It is quadratic rather than linear, which is worth saying. The number of
built-in DSQs scales with nr_cpu_ids too, because most of them are
initialised inside for_each_possible_cpu():
ext.c:8681 SCX_DSQ_LOCAL
ext.c:8683 SCX_DSQ_REJECT (CONFIG_EXT_SUB_SCHED)
ext.c:7172 SCX_DSQ_BYPASS
sub.c:672 SCX_DSQ_RESCUE (per rq, via scx_rescue_init())
Only SCX_DSQ_GLOBAL is a single instance. Each of those then allocates
nr_cpu_ids entries, so what you drop is on the order of nr_cpu_ids^2
struct scx_dsq_pcpu, which on a large machine is a very different number
from the one the changelog suggests.
The guard holds. ext.c:1130 is the only read of dsq->pcpu, and it already
sits under !(dsq->id & SCX_DSQ_FLAG_BUILTIN) at 1127, the complement of
what you skip on; the local DSQ branch above uses sch->pcpu instead. All
five ids passed to scx_init_dsq() carry the flag (sched/ext.h:58-62), so
nothing is missed either. exit_dsq() contains nothing but the pcpu walk
and the free, so the early return skips nothing else, and it is needed
rather than tidy: per_cpu_ptr(NULL, cpu) hands the loop an offset pointer
and list_empty() would read it, so relying on free_percpu(NULL) alone
would not do.
Two smaller things. A Fixes: tag routes this to stable, which is more
than a memory saving asks for unless you see a correctness angle. And the
mail header says "Qiurong Fang" while the From: and Signed-off-by in the
body say "fangqiurong".
Thanks,
Zhan Xusheng
next prev parent reply other threads:[~2026-08-27 9:38 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-27 8:23 Qiurong Fang
2026-08-27 9:38 ` Zhan Xusheng [this message]
2026-08-31 16:13 ` Tejun Heo
2026-09-01 1:32 ` [PATCH v2] " Qiurong Fang
2026-09-01 2:20 ` Zhan Xusheng
2026-09-02 6:57 ` Tejun Heo
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260827093838.532352-1-zhanxusheng1024@gmail.com \
--to=zhanxusheng1024@gmail.com \
--cc=arighi@nvidia.com \
--cc=changwoo@igalia.com \
--cc=fangqiurong@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=sched-ext@lists.linux.dev \
--cc=tj@kernel.org \
--cc=void@manifault.com \
--cc=zhanxusheng@xiaomi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®