From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3500C3ABBF for ; Wed, 7 May 2025 11:05:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D9C666B0093; Wed, 7 May 2025 07:05:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id D25476B0095; Wed, 7 May 2025 07:05:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id BC5DC6B0098; Wed, 7 May 2025 07:05:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 9D7136B0095 for ; Wed, 7 May 2025 07:05:15 -0400 (EDT) Received: from smtpin22.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 7A7F1161BB5 for ; Wed, 7 May 2025 11:05:15 +0000 (UTC) X-FDA: 83415830190.22.D3DAEE0 Received: from fanzine2.igalia.com (fanzine2.igalia.com [213.97.179.56]) by imf23.hostedemail.com (Postfix) with ESMTP id DAE0B140004 for ; Wed, 7 May 2025 11:05:13 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=pmnPzs+o; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf23.hostedemail.com: domain of bhupesh@igalia.com designates 213.97.179.56 as permitted sender) smtp.mailfrom=bhupesh@igalia.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1746615914; a=rsa-sha256; cv=none; b=NFDM2WKPT5UBzAtndYw6YM6qmYZozJUWufRp99/piKfnYtfLZnOWM+iiDE5SYP89RwCtcI ITbB8yFuJ7ubaXtDfpMi4RltwaYyaInQDtnRKR+t2wb8z+8N/Dh1j7SCrYMRusM9UZsnLP qdK78q8XTBDXVbusM8izKQG/E2FPowU= ARC-Authentication-Results: i=1; imf23.hostedemail.com; dkim=pass header.d=igalia.com header.s=20170329 header.b=pmnPzs+o; dmarc=pass (policy=none) header.from=igalia.com; spf=pass (imf23.hostedemail.com: domain of bhupesh@igalia.com designates 213.97.179.56 as permitted sender) smtp.mailfrom=bhupesh@igalia.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1746615914; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:references:dkim-signature; bh=MWniPNd5Htz13/JraQ6uRQSWXj4Du7d719u+dg9Yg0M=; b=nv3lf0DSdHqBalGV7qke9yVGkkZi7TRV5RKjiDH/Tm6BfT4e7H3IC8+99saOaLIeT23kWV oDyFahW6KZvnewcsx5In688EOpdfXiDTruxG8L5Aw7IwnSfH6oU745wPrJxPopdJOOjMUf NM9ydw3Zd/livsOaiFT+nza6pQgU68E= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=igalia.com; s=20170329; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=MWniPNd5Htz13/JraQ6uRQSWXj4Du7d719u+dg9Yg0M=; b=pmnPzs+oEfcW1E8ldrUF6E89Qu r0GAuK4AXFSZL5Blg/ri5/lMRPYKLLgRRcR1xQLcRFFSMbeoDwTzidxF1zSajffPHijhLBnBnhKnh vVWidQCYQLgKCpymomEn2BjCgiGoQU1Od9pGzEuBJ+hBoNlvZOQ4n2fB6It+my4q4uGei5qz1dzBQ X6xXg6jcHo8gTMTEl79pRtzm/YlCCt9YzKdAo9DEdWwCeAbNtYT9BNbiNSLzPQTbsi0DsMeAvj5dw d2sIZvfTyetwjTwnlnCOreUxTt+Nb5eaAwS5+0swYqVm5cWzNpoPUd5TNhhu1cgArZBa5mxX00NLR 37NxD27w==; Received: from [223.233.66.62] (helo=localhost.localdomain) by fanzine2.igalia.com with esmtpsa (Cipher TLS1.3:ECDHE_X25519__RSA_PSS_RSAE_SHA256__AES_256_GCM:256) (Exim) id 1uCcWN-004fhg-T3; Wed, 07 May 2025 13:04:58 +0200 From: Bhupesh To: akpm@linux-foundation.org Cc: bhupesh@igalia.com, kernel-dev@igalia.com, linux-kernel@vger.kernel.org, bpf@vger.kernel.org, linux-perf-users@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-mm@kvack.org, oliver.sang@intel.com, lkp@intel.com, laoar.shao@gmail.com, pmladek@suse.com, rostedt@goodmis.org, mathieu.desnoyers@efficios.com, arnaldo.melo@gmail.com, alexei.starovoitov@gmail.com, andrii.nakryiko@gmail.com, mirq-linux@rere.qmqm.pl, peterz@infradead.org, willy@infradead.org, david@redhat.com, viro@zeniv.linux.org.uk, keescook@chromium.org, ebiederm@xmission.com, brauner@kernel.org, jack@suse.cz, mingo@redhat.com, juri.lelli@redhat.com, bsegall@google.com, mgorman@suse.de, vschneid@redhat.com Subject: [PATCH v3 0/3] Add support for long task name Date: Wed, 7 May 2025 16:34:41 +0530 Message-Id: <20250507110444.963779-1-bhupesh@igalia.com> X-Mailer: git-send-email 2.38.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: DAE0B140004 X-Stat-Signature: s3ea3mp3a479o7t33dhgahf4ct3sx188 X-Rspam-User: X-HE-Tag: 1746615913-270828 X-HE-Meta: U2FsdGVkX1++FIUTMhzl7zq8pyK6n5GsqGt//lJHtUprgWQrrGHAJLe9B3DdmH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KA2wep5XORjjdoGv7qEHvyW+AldLovnbW8OCt9w/NntUQddq5Oe9rkLPXIfjQjaI8KNQWSKLEGNBIhNiDVSFaw1/PflbAwSLYA0o7SSjBtL2lkmW8evaSrIKeV42oW3+zAxpwj9qpApefeHYv685VJd/kZ1VT5338tj5qndUu0QQF9no1BvXmuTmr/vn/833d7WIgPx/pWby3VHRVV3IFVqyGlUH41tqPQVLozQKJAL4o6hQbxx55UJ8HDIIATpw1HP/lDekjYEyzJxY6B X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: 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: ). - 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