[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250507110444.963779-1-bhupesh@igalia.com>
Date: Wed, 7 May 2025 16:34:41 +0530
From: Bhupesh <bhupesh@...lia.com>
To: akpm@...ux-foundation.org
Cc: bhupesh@...lia.com,
kernel-dev@...lia.com,
linux-kernel@...r.kernel.org,
bpf@...r.kernel.org,
linux-perf-users@...r.kernel.org,
linux-fsdevel@...r.kernel.org,
linux-mm@...ck.org,
oliver.sang@...el.com,
lkp@...el.com,
laoar.shao@...il.com,
pmladek@...e.com,
rostedt@...dmis.org,
mathieu.desnoyers@...icios.com,
arnaldo.melo@...il.com,
alexei.starovoitov@...il.com,
andrii.nakryiko@...il.com,
mirq-linux@...e.qmqm.pl,
peterz@...radead.org,
willy@...radead.org,
david@...hat.com,
viro@...iv.linux.org.uk,
keescook@...omium.org,
ebiederm@...ssion.com,
brauner@...nel.org,
jack@...e.cz,
mingo@...hat.com,
juri.lelli@...hat.com,
bsegall@...gle.com,
mgorman@...e.de,
vschneid@...hat.com
Subject: [PATCH v3 0/3] Add support for long task name
Changes since v2:
================
- v2 can be seen here: https://lore.kernel.org/lkml/20250331121820.455916-1-bhupesh@igalia.com/
- As suggested by Yafang and Kees, picked Linus' suggested approach for
this version (see: <https://lore.kernel.org/all/CAHk-=wjAmmHUg6vho1KjzQi2=psR30+CogFd4aXrThr2gsiS4g@mail.gmail.com/>).
- Dropped kthreads patch from this version. It would be sent out
separately, if we have a consensus on this approach.
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.
In this version, as Linus suggested, we can add the
following union inside 'task_struct':
union {
char comm[TASK_COMM_LEN];
char real_comm[REAL_TASK_COMM_LEN];
};
and then modify '__set_task_comm()' to pass 'tsk->real_comm'
to the existing users.
So, eventually:
- users who want the existing 'TASK_COMM_LEN' behavior will get it
(existing ABIs would continue to work),
- users who just print out 'tsk->comm' as a string will get the longer
new "real comm",
- users who do 'sizeof(->comm)' will continue to get the old value
because of the union.
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: Remove obsolete comments
treewide: Switch memcpy() users of 'task->comm' to a more safer
implementation
exec: Add support for 64 byte 'tsk->real_comm'
fs/exec.c | 6 +++---
include/linux/coredump.h | 3 ++-
include/linux/sched.h | 14 ++++++++------
include/trace/events/block.h | 5 +++++
include/trace/events/oom.h | 1 +
include/trace/events/osnoise.h | 1 +
include/trace/events/sched.h | 13 +++++++++++++
include/trace/events/signal.h | 1 +
include/trace/events/task.h | 2 ++
9 files changed, 36 insertions(+), 10 deletions(-)
--
2.38.1
Powered by blists - more mailing lists