From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 89AAA399019 for ; Thu, 14 May 2026 09:24:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778750643; cv=none; b=EYwNTB+UMhDPFLjYi1hb59NndFxpDrbq4ygvVZOwQAGni+rOCk5ObOA36GY8sXA13r5PH4V1YePueYuO4pDBlxR9o3shKcWv8zhJabBZrgF37wOv2wwe4nYCGAqvfq3hqpprPc2jFbswkLwMzYkXRAKrVpmrRnscA7O6912X4Ro= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778750643; c=relaxed/simple; bh=8rglQeI89akvH6GmnZKDRhhlbhEWOFili1sPvBuOkwc=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=OKCIexneHSSwPZ4AJClOzOLZ3yz2VeSNyShafZKgvlbAshWEvN3Wqicnhih1tlVCcd6QWMJQwdYcMBEQJGNAXZjDvNa1o/6Nj5P/j2XuSvKPUxd7lkt51GJIfamo/RgJyb7PmpXw/781hCijFCHLQDBWOG7KGNJnZQFYXfzAoq4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com; spf=pass smtp.mailfrom=suse.com; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b=A++f+UCE; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=suse.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=suse.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=suse.com header.i=@suse.com header.b="A++f+UCE" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-488a9033b2cso68611885e9.2 for ; Thu, 14 May 2026 02:24:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1778750639; x=1779355439; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=Pp6qsVZ3Q3JVTyMiB78tkebAZ/aml/8lHSwl2A4rQpI=; b=A++f+UCEvSXR6KdHL8DET/W71IJjRxIQUR7zRCv0m9KRKLdMD3eH0EM2ne8q0meTnZ nubMnSeF/+j28MnsxYAlYaSyxhzL7oldLF25Xp84cgIKRhAAj2/aNDLixTWc0OE7YVZx 6kezdQ6vIU8GO2ivnxN8oQsKyfLu1ZQptbmnyqJVqnLjQUorfxSOHN0/HtLsXoOy01Lz QiBnBk4favDsJCXnpcn9VFEGnvU1D9B+qrHkjTgMLGv/PuMItlU5pB9wELOgAG+Jgypu 7hW4fmqR3EVjgaxSqbBR76Qpq6A7ZKSFq0QAIMPRMi8mWi91cwBY9egjAIpcUEkiDDay geqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778750639; x=1779355439; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Pp6qsVZ3Q3JVTyMiB78tkebAZ/aml/8lHSwl2A4rQpI=; b=MsFnYaNL+naTXHGrigda0jTfraO7OFHUENoaiaS5nVj0a2PL/qwamXwB3KjvVDhb+O RPkSRjsK3nV+/r0slqP/G7sbW1pYnMk/LUBXBylvTIPJWM0AMTIzGWjVo4Dk1/QlAO1C VAvSKkzH60E2zEgwtZgYydHnOFV20RuWlgXcanBZAz/x3gBYfvmAa/7S57UQNjwEj862 JWbi1L1e5ElOgHKqqn65ywmSmx8S9d8xpeQDT5lLFuX1c1O1ag9+THfqY60wUoTFMJy3 EhtQpq2DYaQJMC8Vw1yZ2yRQ44oqE9CeGOO4XkCiAhGiQmWVkiP4uCRuYM5vQt4z/K9S wTlA== X-Gm-Message-State: AOJu0Yxw2M555YBrqhTiuHDaldG7WhRAKr2A54L9GZXP9hnhPYyhtgSj 66e1/v+zDdp9MCUmxKVMjzLG56L4dAz/zucq11gEuFwIlxylwcpyVvLnzRqyXC0W/7FMuUcq/PK dlOhUcgQ= X-Gm-Gg: Acq92OFTHiLi9a0bgCuB7ngHLe/9MYgMCT70NXTPSu2Qbg3XsfFV8KQ9DXAna5sn93G Nl4cwEZWup/LATgaIDbsPoOa1m9mf9LWOFSm7WdfCIKpnKMtEqSsvNC1bAOItZMA2IYBxJEQV8h bQz8fBO+ePYn4w7nfodMLxNmaubn4RT3MAKJjS4E0PYnzFQy9adlUsFmzogmW8Ab/faXm1QMGsH EJ2J3fsagXkigLEL95XWsKwkstDOsdHoV1e5BrrMlMVOXfE3v/6Zx+KRuWC71RG3AhfJbpYtG2p zsJEIOd/CzawFLriWID3rCApRlgbUU1zr3l6K7Rrq5ov/3p7MIB0P0qfsA0Aa1yGHLlpoq/Lhzp rm0heHP2yHHwJ9AIusiRpGv3nmnthVh9nxIf7AU7eWKEClQrRJo2UGxiAmnYJPkxDdqxYWNROUj /L8SCJM73oY41ayPL0MCE2RvgcpO4m+oamUJW1PmIrQs3kqQY= X-Received: by 2002:a05:600c:468e:b0:48a:6fd4:d3d3 with SMTP id 5b1f17b1804b1-48fc9a3d8c5mr93446825e9.20.1778750639307; Thu, 14 May 2026 02:23:59 -0700 (PDT) Received: from localhost.localdomain ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45d9ec3acf7sm5353467f8f.12.2026.05.14.02.23.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 02:23:58 -0700 (PDT) From: Marco Crivellari To: linux-kernel@vger.kernel.org Cc: Tejun Heo , Lai Jiangshan , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Breno Leitao Subject: [RFC PATCH 0/2] workqueue: Add wornings and check WQ flags usage Date: Thu, 14 May 2026 11:23:52 +0200 Message-ID: <20260514092354.125149-1-marco.crivellari@suse.com> X-Mailer: git-send-email 2.54.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Hi, Currently system_wq and system_unbound_wq can still be used and no message is printed. To avoid further use of them, add a warning and route the workqueue on system_percpu_wq or system_dfl_wq. Similar scenario for WQ_PERCPU and WQ_UNBOUND. Currently there are still users that use alloc_workqueue(,0,). To avoid such situations, a couple of checks have been added: - if neither of the flag is present, set WQ_PERCPU - if both are present, remove WQ_PERCPU Along with these, a warning will be printed. ~~~~ Few things to note, and that's the main reason because it is an RFC: 1. I wanted to use a compile time error, but considering the new users still relying on the old workqueue or using alloc_workqueue() without one of the flags, it means break the code. So I decided to avoid. 2. there are no compile-time warnings: should we add something? 3. __alloc_workqueue() prints the WQ_* messages with pr_warn_ratelimited(); I used this because otherwise with the _once version we're going to see only the 1st. 4. another option would have been make the workqueue unbound by default, but of course, it's still not possible due to point 1. Thanks! Marco Crivellari (2): workqueue: Add warn and fallback if system_{unbound}_wq is used workqueue: Add warnings and ensure one among WQ_PERCPU or WQ_UNBOUND is present kernel/workqueue.c | 72 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) -- 2.54.0