All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Zijlstra <peterz@infradead.org>
To: Chris Down <chris@chrisdown.name>
Cc: "Greg Kroah-Hartman" <gregkh@linuxfoundation.org>,
	"Tejun Heo" <tj@kernel.org>,
	"Johannes Weiner" <hannes@cmpxchg.org>,
	"Michal Koutný" <mkoutny@suse.com>,
	"Serge Hallyn" <serge.hallyn@ubuntu.com>,
	"Ingo Molnar" <mingo@redhat.com>,
	"Juri Lelli" <juri.lelli@redhat.com>,
	"Vincent Guittot" <vincent.guittot@linaro.org>,
	"Dietmar Eggemann" <dietmar.eggemann@arm.com>,
	"Steven Rostedt" <rostedt@goodmis.org>,
	"Ben Segall" <bsegall@google.com>, "Mel Gorman" <mgorman@suse.de>,
	"Valentin Schneider" <vschneid@redhat.com>,
	"K Prateek Nayak" <kprateek.nayak@amd.com>,
	"Yonghong Song" <yonghong.song@linux.dev>,
	"Alexei Starovoitov" <ast@kernel.org>,
	"Daniel Borkmann" <daniel@iogearbox.net>,
	"Andrii Nakryiko" <andrii@kernel.org>,
	"Eduard Zingerman" <eddyz87@gmail.com>,
	"Kumar Kartikeya Dwivedi" <memxor@gmail.com>,
	driver-core@lists.linux.dev, cgroups@vger.kernel.org,
	bpf@vger.kernel.org, linux-kernel@vger.kernel.org,
	kernel-team@meta.com, sashiko-bot@kernel.org
Subject: Re: [PATCH v3 2/3] sched/debug: Drop the "..." suffix from truncated group paths
Date: Mon, 30 Nov 2026 08:58:42 +0100	[thread overview]
Message-ID: <20261130075842.GI2668804@noisy.programming.kicks-ass.net> (raw)
In-Reply-To: <e862fbf44f8775897fde00c76fcf111f4ab87857.1796009856.git.chris@chrisdown.name>

On Sun, Nov 29, 2026 at 07:48:20PM -0800, Chris Down wrote:
> When another reader holds sched_debug_lock,
> SEQ_printf_task_group_path() builds the group path in a 128 byte buffer
> on the stack, and writes "..." over the end of it in case the path
> filled it. Since the previous commit, cgroup_path() keeps the end of a
> path which doesn't fit and puts "..." at its start, so a long path now
> prints with "..." at both ends, which suggests the end was cut off when
> it wasn't.
> 
> Let's drop the suffix and leave marking the truncation to cgroup_path().
> 
> Signed-off-by: Chris Down <chris@chrisdown.name>

So truncated paths now look like: "...oo/bar", rather than "/foo/b..." ?

Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>

> ---
>  kernel/sched/debug.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
> 
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index e6a3b516c703..328db4809780 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -941,9 +941,7 @@ static void task_group_path(struct task_group *tg, char *path, int plen)
>  /*
>   * Only 1 SEQ_printf_task_group_path() caller can use the full length
>   * group_path[] for cgroup path. Other simultaneous callers will have
> - * to use a shorter stack buffer. A "..." suffix is appended at the end
> - * of the stack buffer so that it will show up in case the output length
> - * matches the given buffer size to indicate possible path name truncation.
> + * to use a shorter stack buffer.
>   */
>  #define SEQ_printf_task_group_path(m, tg, fmt...)			\
>  {									\
> @@ -953,9 +951,7 @@ static void task_group_path(struct task_group *tg, char *path, int plen)
>  		spin_unlock(&sched_debug_lock);				\
>  	} else {							\
>  		char buf[128];						\
> -		char *bufend = buf + sizeof(buf) - 3;			\
> -		task_group_path(tg, buf, bufend - buf);			\
> -		strcpy(bufend - 1, "...");				\
> +		task_group_path(tg, buf, sizeof(buf));			\
>  		SEQ_printf(m, fmt, buf);				\
>  	}								\
>  }
> -- 
> 2.56.1
> 

  reply	other threads:[~2026-11-30  7:58 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-30  3:48 [PATCH v3 0/3] kernfs: Build paths in linear time with respect to depth Chris Down
2026-11-30  3:48 ` [PATCH v3 1/3] " Chris Down
2026-11-30  3:48 ` [PATCH v3 2/3] sched/debug: Drop the "..." suffix from truncated group paths Chris Down
2026-11-30  7:58   ` Peter Zijlstra [this message]
2026-11-30 15:40     ` Chris Down
2026-11-30  3:48 ` [PATCH v3 3/3] bpf: Describe cgroup_iter's fdinfo path for paths which don't fit Chris Down
2026-11-30  4:45 ` [PATCH v3 0/3] kernfs: Build paths in linear time with respect to depth 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=20261130075842.GI2668804@noisy.programming.kicks-ass.net \
    --to=peterz@infradead.org \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=bsegall@google.com \
    --cc=cgroups@vger.kernel.org \
    --cc=chris@chrisdown.name \
    --cc=daniel@iogearbox.net \
    --cc=dietmar.eggemann@arm.com \
    --cc=driver-core@lists.linux.dev \
    --cc=eddyz87@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=juri.lelli@redhat.com \
    --cc=kernel-team@meta.com \
    --cc=kprateek.nayak@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=memxor@gmail.com \
    --cc=mgorman@suse.de \
    --cc=mingo@redhat.com \
    --cc=mkoutny@suse.com \
    --cc=rostedt@goodmis.org \
    --cc=sashiko-bot@kernel.org \
    --cc=serge.hallyn@ubuntu.com \
    --cc=tj@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=vschneid@redhat.com \
    --cc=yonghong.song@linux.dev \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.