LKML Archive mirror
 help / color / mirror / Atom feed
From: Audra Mitchell <audra@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: tj@kernel.org, jiangshanlai@gmail.com,
	hirokazu.yamauchi.hk@hitachi.com, ddouwsma@redhat.com,
	loberman@redhat.com, raquini@redhat.com,
	rasmus.villemoes@prevas.dk
Subject: [PATCH v3] workqueue.c: Increase workqueue name length
Date: Mon, 15 Jan 2024 12:08:22 -0500	[thread overview]
Message-ID: <20240115170822.451231-1-audra@redhat.com> (raw)
In-Reply-To: <20231215193954.1785069-1-audra@redhat.com>

Currently we limit the size of the workqueue name to 24 characters due to
commit ecf6881ff349 ("workqueue: make workqueue->name[] fixed len")
Increase the size to 32 characters and print a warning in the event
the requested name is larger than the limit of 32 characters.

Signed-off-by: Audra Mitchell <audra@redhat.com>
---
 kernel/workqueue.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/kernel/workqueue.c b/kernel/workqueue.c
index 76e60faed892..8d9dec14b9bb 100644
--- a/kernel/workqueue.c
+++ b/kernel/workqueue.c
@@ -108,7 +108,7 @@ enum {
 	RESCUER_NICE_LEVEL	= MIN_NICE,
 	HIGHPRI_NICE_LEVEL	= MIN_NICE,
 
-	WQ_NAME_LEN		= 24,
+	WQ_NAME_LEN		= 32,
 };
 
 /*
@@ -4666,6 +4666,7 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
 	va_list args;
 	struct workqueue_struct *wq;
 	struct pool_workqueue *pwq;
+	int len;
 
 	/*
 	 * Unbound && max_active == 1 used to imply ordered, which is no longer
@@ -4692,9 +4693,12 @@ struct workqueue_struct *alloc_workqueue(const char *fmt,
 	}
 
 	va_start(args, max_active);
-	vsnprintf(wq->name, sizeof(wq->name), fmt, args);
+	len = vsnprintf(wq->name, sizeof(wq->name), fmt, args);
 	va_end(args);
 
+	if (len >= WQ_NAME_LEN)
+		pr_warn_once("workqueue: name exceeds WQ_NAME_LEN. Truncating to: %s\n", wq->name);
+
 	max_active = max_active ?: WQ_DFL_ACTIVE;
 	max_active = wq_clamp_max_active(max_active, flags, wq->name);
 
-- 
2.43.0


  parent reply	other threads:[~2024-01-15 17:08 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-15 19:39 [PATCH] workqueue.c: Change workqueue to accept variable length name Audra Mitchell
2023-12-21 21:39 ` Tejun Heo
     [not found]   ` <CA+bDH-v6T5vvyOwsphseHwgihdGQta7TZ9tOtt-Fnij92kvU6A@mail.gmail.com>
2023-12-22 17:53     ` Tejun Heo
2024-01-09 13:29       ` Audra Mitchell
2024-01-10 20:29 ` [PATCH v2] workqueue.c: Increase workqueue name length Audra Mitchell
2024-01-10 20:47   ` Rasmus Villemoes
2024-01-10 21:52     ` Rafael Aquini
2024-01-10 22:06       ` Rasmus Villemoes
2024-01-10 22:31         ` Rafael Aquini
2024-01-10 22:45           ` Rafael Aquini
2024-01-10 22:58             ` Rasmus Villemoes
2024-01-10 22:52           ` Rasmus Villemoes
2024-01-10 23:08             ` Rafael Aquini
2024-01-15 17:08 ` Audra Mitchell [this message]
2024-01-16 18:31   ` [PATCH v3] " Tejun Heo
2024-01-17 14:40     ` Audra Mitchell
2024-01-17 17:09       ` Tejun Heo
2024-01-19 20:30         ` Audra Mitchell
2024-01-19 23:44           ` Tejun Heo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240115170822.451231-1-audra@redhat.com \
    --to=audra@redhat.com \
    --cc=ddouwsma@redhat.com \
    --cc=hirokazu.yamauchi.hk@hitachi.com \
    --cc=jiangshanlai@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=loberman@redhat.com \
    --cc=raquini@redhat.com \
    --cc=rasmus.villemoes@prevas.dk \
    --cc=tj@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 read-only IMAP folder(s) and NNTP newsgroup(s).