From nobody Mon Feb 9 19:38:13 2026 Received: from szxga01-in.huawei.com (szxga01-in.huawei.com [45.249.212.187]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 649C4153586 for ; Mon, 13 May 2024 14:01:38 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=45.249.212.187 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715608902; cv=none; b=SqRyiIqNGxkraSjmKbZHDY91/Q5d1BsNkiQiobk4aC5rEAk6OBOCwUwJLpCJ2Y5d6XxQpg2AhKRfb3V8sXGhGKjGTd/D5Q60/s2lLUETWow7pNLh31Poxg+T4Yy72kG7z2QPZD96xNUXYXJg2X2tdbTqK+59RWxcYwytsbY3mEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715608902; c=relaxed/simple; bh=HPa93/yyuhVjmfwRFTysZ4WvwSZHtZfjl7F3cX7WKp4=; h=From:To:CC:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=fh+PIKl31mtjrMJZ0D3JwaqCTuTku744jcBd3dtP9lzzsr9SKr9j946TZVZU+Yf7uxdhN8jBiwf3nTvTHeUFPtjpro+50CKs9HZ2Gqng9l5RzLX3n0m64TmQuwCWT5uykPncJj2MvbO6sPoM0r/NwYY8Ry1Rp8aNEEW9G24pf2Q= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com; spf=pass smtp.mailfrom=huawei.com; arc=none smtp.client-ip=45.249.212.187 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=huawei.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=huawei.com Received: from mail.maildlp.com (unknown [172.19.162.254]) by szxga01-in.huawei.com (SkyGuard) with ESMTP id 4VdLfm25WKzvYHl; Mon, 13 May 2024 21:58:08 +0800 (CST) Received: from kwepemm600012.china.huawei.com (unknown [7.193.23.74]) by mail.maildlp.com (Postfix) with ESMTPS id E782D1800B8; Mon, 13 May 2024 22:01:34 +0800 (CST) Received: from build.huawei.com (10.175.101.6) by kwepemm600012.china.huawei.com (7.193.23.74) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.35; Mon, 13 May 2024 22:01:34 +0800 From: Wenchao Hao To: Tejun Heo , Lai Jiangshan , Aaron Tomlin , CC: Wenchao Hao , Wenchao Hao Subject: [PATCH v2 1/2] workqueue: Fix rescuer task's name truncated Date: Mon, 13 May 2024 22:01:14 +0800 Message-ID: <20240513140115.3892827-2-haowenchao2@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20240513140115.3892827-1-haowenchao2@huawei.com> References: <20240513140115.3892827-1-haowenchao2@huawei.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: dggems706-chm.china.huawei.com (10.3.19.183) To kwepemm600012.china.huawei.com (7.193.23.74) Content-Type: text/plain; charset="utf-8" Task comm of task is limitted to 16, prefix "kworker/R-" is added for rescuer worker's task, which cause most task name is truncated as following: root 81 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xprti] root 82 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-cfg80] root 85 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-nfsio] root 86 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xfsal] root 87 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-xfs_m] root 88 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-acpi_] root 93 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-iscsi] root 95 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_] root 97 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_] root 99 0.0 0.0 0 0 ? I< 11:18 0:00 [kworker/R-scsi_] Fix this issue by split rescuer name to 2 part like other kworker, the normal part is "kworker/R" which is set to task_struct's comm, another part is wq->name which is added to kworker's desc. These 2 parts would be merged in wq_worker_comm(). Fixes: b6a46f7263bd ("workqueue: Rename rescuer kworker") Signed-off-by: Wenchao Hao Reviewed-by: Aaron Tomlin --- kernel/workqueue.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index d2dbe099286b..07c077a53f93 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -5443,7 +5443,7 @@ static int init_rescuer(struct workqueue_struct *wq) } =20 rescuer->rescue_wq =3D wq; - rescuer->task =3D kthread_create(rescuer_thread, rescuer, "kworker/R-%s",= wq->name); + rescuer->task =3D kthread_create(rescuer_thread, rescuer, "kworker/R"); if (IS_ERR(rescuer->task)) { ret =3D PTR_ERR(rescuer->task); pr_err("workqueue: Failed to create a rescuer kthread for wq \"%s\": %pe= ", @@ -5452,6 +5452,8 @@ static int init_rescuer(struct workqueue_struct *wq) return ret; } =20 + snprintf(rescuer->desc, sizeof(rescuer->desc), "%s", wq->name); + wq->rescuer =3D rescuer; if (wq->flags & WQ_UNBOUND) kthread_bind_mask(rescuer->task, wq_unbound_cpumask); @@ -6302,6 +6304,8 @@ void wq_worker_comm(char *buf, size_t size, struct ta= sk_struct *task) worker->desc); } raw_spin_unlock_irq(&pool->lock); + } else if (worker->desc[0] !=3D '\0') { + scnprintf(buf + off, size - off, "-%s", worker->desc); } } =20 --=20 2.32.0