linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/3] Dynamically allocate memory to store task's full name
@ 2025-03-31 12:18 Bhupesh
  2025-03-31 12:18 ` [PATCH v2 1/3] exec: " Bhupesh
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Bhupesh @ 2025-03-31 12:18 UTC (permalink / raw)
  To: akpm
  Cc: bhupesh, kernel-dev, linux-kernel, bpf, linux-perf-users,
	linux-fsdevel, linux-mm, oliver.sang, lkp, laoar.shao, pmladek,
	rostedt, mathieu.desnoyers, arnaldo.melo, alexei.starovoitov,
	andrii.nakryiko, mirq-linux, peterz, willy, david, viro, keescook,
	ebiederm, brauner, jack, mingo, juri.lelli, bsegall, mgorman,
	vschneid

Changes since v1:
================
- v1 can be seen here: https://lore.kernel.org/lkml/20250314052715.610377-1-bhupesh@igalia.com/
- As suggested by Kees, added [PATCH 3/3] to have a consistent
  'full_name' entry inside 'task_struct' which both tasks and
  kthreads can use.
- Fixed the commit message to indicate that the existing ABI
  '/proc/$pid/task/$tid/comm' remains untouched and a parallel
  '/proc/$pid/task/$tid/full_name' ABI for new (interested) users.

While working with user-space debugging tools which work especially
on linux gaming platforms, I found that the task name is truncated due
to the limitation of TASK_COMM_LEN.

Now, during debug tracing, seeing truncated names is not very useful,
especially on gaming platforms where the number of tasks running can
be very high.

This patch does not touch 'TASK_COMM_LEN' at all, i.e.
'TASK_COMM_LEN' and the 16-byte design remains untouched. Which means
that all the legacy / existing ABI, continue to work as before using
'/proc/$pid/task/$tid/comm'.

This patch only adds a parallel, dynamically-allocated
'task->full_name' which can be used by interested users
via '/proc/$pid/task/$tid/full_name'.

After this change, gdb is able to show full name of the task, using a
simple app which generates threads with long names [see 1]:
  # gdb ./threadnames -ex "run info thread" -ex "detach" -ex "quit" > log
  # cat log

  NameThatIsTooLongForComm[4662]

[1]. https://github.com/lostgoat/tasknames

Bhupesh (3):
  exec: Dynamically allocate memory to store task's full name
  fs/proc: Pass 'task->full_name' via 'proc_task_name()'
  kthread: Use 'task_struct->full_name' to store kthread's full name

 fs/exec.c             | 21 ++++++++++++++++++---
 fs/proc/array.c       |  2 +-
 include/linux/sched.h |  9 +++++++++
 kernel/kthread.c      |  9 +++------
 4 files changed, 31 insertions(+), 10 deletions(-)

-- 
2.38.1


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2025-04-09 11:31 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-31 12:18 [PATCH v2 0/3] Dynamically allocate memory to store task's full name Bhupesh
2025-03-31 12:18 ` [PATCH v2 1/3] exec: " Bhupesh
2025-04-01  2:07   ` Yafang Shao
2025-04-04  6:35     ` Bhupesh Sharma
2025-04-06  2:28       ` Yafang Shao
2025-04-09 11:13         ` Bhupesh Sharma
2025-04-01  4:02   ` Harry Yoo
2025-04-04  5:31     ` Bhupesh Sharma
2025-04-03 16:17   ` Andrii Nakryiko
2025-04-04  5:36     ` Bhupesh Sharma
2025-04-03 16:30   ` Kees Cook
2025-04-04  6:48     ` Bhupesh Sharma
2025-04-04 17:24       ` Kees Cook
2025-04-09 11:31         ` Bhupesh Sharma
2025-03-31 12:18 ` [PATCH v2 2/3] fs/proc: Pass 'task->full_name' via 'proc_task_name()' Bhupesh
2025-03-31 12:18 ` [PATCH v2 3/3] kthread: Use 'task_struct->full_name' to store kthread's full name Bhupesh
2025-04-03 16:24   ` Kees Cook
2025-04-04  6:38     ` Bhupesh Sharma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).