Re: [PATCH v3 2/3] sched/debug: Drop the "..." suffix from truncated group paths

From: Peter Zijlstra

Date: Mon Nov 30 2026 - 02:59:02 EST


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@xxxxxxxxxxxxxx>

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

Acked-by: Peter Zijlstra (Intel) <peterz@xxxxxxxxxxxxx>

> ---
> 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
>