Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp1298325pxb; Thu, 7 Oct 2021 05:09:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzx9MuBvA8Jt6LoDXnzX8772H4RzN1a5cWrJhfu5NfQ+qtA11JDyRZMS5fu0BxP1GEQS+kf X-Received: by 2002:a63:5544:: with SMTP id f4mr3082771pgm.431.1633608563479; Thu, 07 Oct 2021 05:09:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1633608563; cv=none; d=google.com; s=arc-20160816; b=N3ulxEAUUUNf+g0CwnPERta5EntuhJMM5Xkp7HwhCD5nUA3MxaAuDKKC+cSVnjGvOa C9WzF5cgwjnb41IXqK5KbuxeayQud66k7uFjUcSFfwLv5ln1dHcqR7D0NmvAW2XM2LD9 bRh11cGBvTX7ZtLgXpnjc1GzFu5VUgqjozF0G2+p+74MLx8QdkYHp9pJhKBhEi7VwPaE FB6uiqJ+XwCobwwP6hPqIqGv+PODcwHqM/l+E8b8TonDPMqbCq+emoXLAHdkafZuHrZp Ta+6HahOYb4FKZ86QXF8Q9ynqdIXXu/ECJe0Q86pt3nsSoRVKzDkcJ8J+MKuBi708A+w YSvQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=K6lt1mC6EArgKpheZppb0+evsrA+udkrMy50tagJwNs=; b=kjJNtN9/m7oD1rZXcF1uM4WHcsshLcu87TbvyrX1tVSrLIRSyTnjmIX5AjFWd4OMJi Mno2HOcnJqvqQ0Xr/VVOCDjSbzXL7WlMRWQA3Jj1CPT5o0InXIm8tGlHXW5qCLhokURW Rz3NmdiUdhBUz9fyH8lFwaPgiWFhNfw1S95ycqxJM/QkpZLs7uSlA4Aedb2IZA5ARIXX 8puSOXRCKaBxhS8dKxolo31ivjX/0I9zPwOpuOIQ4S1H/zI7ECxd9BqX4+ygqsJpNCn2 JSi/WLEksbCPNVrE9aSDl5YclQu8poPBOquoyI4fKgW0PbF9csidIQgXhzVgdZHrxiE9 FFng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KVlDoOn3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id 14si29643345pgo.462.2021.10.07.05.09.06; Thu, 07 Oct 2021 05:09:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=KVlDoOn3; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241193AbhJGMJ7 (ORCPT + 99 others); Thu, 7 Oct 2021 08:09:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50808 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232903AbhJGMJv (ORCPT ); Thu, 7 Oct 2021 08:09:51 -0400 Received: from mail-pg1-x52b.google.com (mail-pg1-x52b.google.com [IPv6:2607:f8b0:4864:20::52b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B1447C061746 for ; Thu, 7 Oct 2021 05:07:57 -0700 (PDT) Received: by mail-pg1-x52b.google.com with SMTP id r201so5484354pgr.4 for ; Thu, 07 Oct 2021 05:07:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=K6lt1mC6EArgKpheZppb0+evsrA+udkrMy50tagJwNs=; b=KVlDoOn328T+4wIgbkkefgu4gA5L6rmoxFLDmzmvSoZJ5cZi30PtBpGKRvjNM+S2aO TH8EPY27s3n1b7zGgcKrCGvUtRrqNKW/0zKqqyIoP+pUhmYebUXDcs8UwBJoF/ho7IV4 GF3kIj5fksfp3vKB2Eop9o2o8/ENWNfCLjnRmy4kGJZ2yKz7tL5hrpLhPPJhfFHUzh7/ xZad12vJywAeEqXtsbIwWOLwOpAig1W91xcrHWos1BmzTtZmF12YeRXgx07ahEhdsBAb f7ED8q3AyBbW1Db/rBY4/DONMZMHGgcsgvoI50XP1JMQmpY4ipvVYZqlg6S8DYKZSrk+ X/Ew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=K6lt1mC6EArgKpheZppb0+evsrA+udkrMy50tagJwNs=; b=QYK9ZUSkkaLA55QE17RbKecZ3AoMQa4jv8zGGQpZ3GZPK06zKQHij8TV5yWye1M5i7 QfR3M3gbcdQqihpe1X+TjJLEz0iXT2G912r8N76lYXLwgk+OlcKsH4nikpbfZ8Zs4NnY mN7J7omt74FqhUCUwivNUbXZS91XIphrNePlmBvY0nzvbkHH6FA0libGIHVeE7PhZGWT LGGMbVac3bZyhj/BQWiQEDMVP1DmfmfJjvIeb8ZhoSKJFa9odoMLiC+BRY6xO6i/JGcr AlPR4jxyH7EjgZgEGQopcGRHzYYzOrLdOLACnAfTA7ty32+jDz109pCfnVgwqPGoly7P zBjg== X-Gm-Message-State: AOAM531ZFkG4pg4WSF/b00N5iHKQJzUM2kJJTHWMsT4B9TrAH8vg+zxc mSZcbe2gHSywBUCehIep6K8= X-Received: by 2002:a62:6243:0:b0:44b:e10e:61b0 with SMTP id w64-20020a626243000000b0044be10e61b0mr3927102pfb.53.1633608477250; Thu, 07 Oct 2021 05:07:57 -0700 (PDT) Received: from localhost.localdomain ([144.202.123.152]) by smtp.gmail.com with ESMTPSA id c8sm23915582pfj.204.2021.10.07.05.07.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Oct 2021 05:07:56 -0700 (PDT) From: Yafang Shao To: pmladek@suse.com, keescook@chromium.org, viro@zeniv.linux.org.uk, akpm@linux-foundation.org, peterz@infradead.org, valentin.schneider@arm.com, mathieu.desnoyers@efficios.com, qiang.zhang@windriver.com, robdclark@chromium.org, christian@brauner.io, dietmar.eggemann@arm.com, mingo@redhat.com, juri.lelli@redhat.com, vincent.guittot@linaro.org, rostedt@goodmis.org, bsegall@google.com, mgorman@suse.de, bristot@redhat.com Cc: linux-kernel@vger.kernel.org, Yafang Shao Subject: [PATCH v2 0/4] task_struct: extend task comm from 16 to 24 for CONFIG_BASE_FULL Date: Thu, 7 Oct 2021 12:07:48 +0000 Message-Id: <20211007120752.5195-1-laoar.shao@gmail.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When I was implementing a new per-cpu kthread cfs_migration, I found the comm of it "cfs_migration/%u" is truncated due to the limitation of TASK_COMM_LEN. For example, the comm of the percpu thread on CPU10~19 are all with the same name "cfs_migration/1", which will confuse the user. This issue is not critical, because we can get the corresponding CPU from the task's Cpus_allowed. But for kthreads correspoinding to other hardware devices, it is not easy to get the detailed device info from task comm, for example, jbd2/nvme0n1p2- nvidia-modeset/ We can also shorten the name to work around this problem, but I find there are so many truncated kthreads: rcu_tasks_kthre rcu_tasks_rude_ rcu_tasks_trace poll_mpt3sas0_s ext4-rsv-conver xfs-reclaim/sd{a, b, c, ...} xfs-blockgc/sd{a, b, c, ...} xfs-inodegc/sd{a, b, c, ...} audit_send_repl ecryptfs-kthrea vfio-irqfd-clea jbd2/nvme0n1p2- ... Besides the in-tree kthreads listed above, the out-of-tree kthreads may also be truncated: rtase_work_queu nvidia-modeset/ UVM global queu UVM deferred re ... We should improve this problem fundamentally. This patch extends the size of task comm to 24 bytes, which is the same length with workqueue's, for the CONFIG_BASE_FULL case. And for the CONFIG_BASE_SMALL case, the size of task comm is still kept as 16 bytes. If the kthread's comm is still truncated, a warning will be printed. Below is the result of my test case: truncated kthread comm:I-am-a-kthread-with-lon, pid:14 by 6 characters Changes since v1: - extend task comm to 24bytes, per Petr - improve the warning per Petr - make the checkpatch warning a seperate patch Yafang Shao (4): cn_proc.h: use TASK_COMM_LEN instread of 16 in struct proc_event fs/exec: use strscpy instead of strlcpy in __set_task_comm sched.h: extend task comm from 16 to 24 for CONFIG_BASE_FULL kernel/kthread: show a warning if kthread's comm is truncated fs/exec.c | 2 +- include/linux/sched.h | 4 ++++ include/uapi/linux/cn_proc.h | 2 +- kernel/kthread.c | 7 ++++++- 4 files changed, 12 insertions(+), 3 deletions(-) -- 2.18.2