From: Zhan Xusheng <zhanxusheng1024@gmail.com>
To: Aaron Tomlin <atomlin@atomlin.com>,
mingo@redhat.com, peterz@infradead.org, juri.lelli@redhat.com,
vincent.guittot@linaro.org
Cc: dietmar.eggemann@arm.com, rostedt@goodmis.org,
bsegall@google.com, mgorman@suse.de, vschneid@redhat.com,
kprateek.nayak@amd.com, neelx@suse.com, sean@ashe.io,
linux-kernel@vger.kernel.org,
Zhan Xusheng <zhanxusheng1024@gmail.com>
Subject: Re: [PATCH] sched/debug: Introduce per-CPU debugfs files
Date: Tue, 28 Jul 2026 14:34:36 +0800 [thread overview]
Message-ID: <20260728063127.812004-1-zhanxusheng1024@gmail.com> (raw)
In-Reply-To: <20260728020309.6169-1-atomlin@atomlin.com>
From: Zhan Xusheng <zhanxusheng1024@gmail.com>
On Mon, Jul 27, 2026 at 10:03:09PM -0400, Aaron Tomlin wrote:
> Currently, accessing scheduler debugging details for a specific CPU
> requires reading /sys/kernel/debug/sched/debug, which outputs
> information for all online CPUs. This results in redundant output and
> parsing overhead on large SMP systems when targeting an individual CPU.
This looks like a handy addition. One thing that might strengthen the
changelog: the bigger win of a targeted per-CPU file isn't really the
userspace parsing overhead (a grep over the existing file is cheap), but
that inspecting a single CPU no longer requires walking every runqueue and
taking each rq lock to produce the full dump - which is what actually
perturbs a large, busy system. Framing it that way makes the case more
compelling.
> + for_each_possible_cpu(cpu) {
> + struct dentry *d_cpu;
> +
> + snprintf(buf, sizeof(buf), "cpu%lu", cpu);
> + d_cpu = debugfs_create_dir(buf, d_cpu_dir);
> +
> + debugfs_create_file("debug", 0444, d_cpu, (void *) cpu, &sched_debug_cpu_fops);
> + }
One design question: the existing /sys/kernel/debug/sched/debug only
iterates cpu_online_mask, whereas this creates cpu<N>/debug
for_each_possible_cpu. Reading an offline (or never-onlined) CPU's file
then calls print_cpu() on a quiescent rq. As far as I can tell that is
harmless - rq->curr is that CPU's idle task from boot, so it just prints
idle/zeroed values - but it does differ from the existing interface, and
where possible CPUs greatly exceed online ones it adds many directories
for CPUs that will never report anything interesting. Was exposing all
possible CPUs intentional, or would gating the files (or their contents)
on online CPUs be preferable?
Thanks,
Zhan Xusheng
next prev parent reply other threads:[~2026-07-28 6:34 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-28 2:03 Aaron Tomlin
2026-07-28 6:34 ` Zhan Xusheng [this message]
2026-07-28 13:21 ` Aaron Tomlin
2026-07-28 10:48 ` Peter Zijlstra
2026-07-28 13:37 ` Daniel Vacek
2026-07-28 13:42 ` Aaron Tomlin
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=20260728063127.812004-1-zhanxusheng1024@gmail.com \
--to=zhanxusheng1024@gmail.com \
--cc=atomlin@atomlin.com \
--cc=bsegall@google.com \
--cc=dietmar.eggemann@arm.com \
--cc=juri.lelli@redhat.com \
--cc=kprateek.nayak@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mgorman@suse.de \
--cc=mingo@redhat.com \
--cc=neelx@suse.com \
--cc=peterz@infradead.org \
--cc=rostedt@goodmis.org \
--cc=sean@ashe.io \
--cc=vincent.guittot@linaro.org \
--cc=vschneid@redhat.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®