From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (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 27AF84A32 for ; Fri, 29 May 2026 13:06:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780060019; cv=none; b=mDpFD2rJowVWOb1zGT49X5nwnGTgfaD8KAtMbVz/h5QNjCiJbQedIZjNxJEsHOwsHptjQVvqnOQqe3cPbAcPLSaWtZjTTErA+JEKsk7Xa7J+d+X6gXLDsgU4uD2zZdF+f+NTQO7QbpscWxwhqk4QGO5LkKfcGzdZD82ZYCXp/Ec= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1780060019; c=relaxed/simple; bh=kaknLVm/ejtE3PJJFt4brgxbN5nVEFJEcDGaQI6SW0A=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=u95e/hz+UZOtxNTz32KH7mvKqV9xbkX+J4/ZUCTN7O1A1P/kQWPT6xgkVDtoswqjz5Z358EoOz+uPXPZ/YqnoN3HtfGmACHYwXFEu29G3OVo9LWYWlciP560/Iuy7c9P1CwTo0FB8llv8jbfFQiLvJcoawIJiZfoltyhMZlFwK4= 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=UNwH+8a0; arc=none smtp.client-ip=209.85.221.47 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="UNwH+8a0" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-45ef616daf6so166794f8f.3 for ; Fri, 29 May 2026 06:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1780060017; x=1780664817; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=SbYrHRmw6BxgxF1GNas9TQg628Cva+DmGIs/8xUdTyE=; b=UNwH+8a064AKJH1x71SEuIH9/iDzFiYaT+XWvCj5SAVqNSkHU0x46iLLbA1BQTPf0F zxkeSv8JEnFXSdSJ7aVG7o053Bo49Ue6QXu7UUmFtw71qO7AkkaJCHCAzCHafnOr3+sg 8QeFYKjM9nBCBjDGmvEuBfbSEWXOPMooXVYzL0yrkMvGdWRCO3XrYZMq5ghCs7HwmFkP 8a3/WL7p3bFh/kh7nRcfVFLN0EXHITUBXmcjTJNrOudxheGcOwa84mvm1owaJS+6b3mz 1Zv7TI7Bk7CDo/PoCbsLeoj1fOGNSxljXvm5ov50tHD9ipK93IyvbilMEPaqu5KdmUIA NyBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1780060017; x=1780664817; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=SbYrHRmw6BxgxF1GNas9TQg628Cva+DmGIs/8xUdTyE=; b=ZLxxG3Z5vHCBwsIvZvpFNgMu5wENmM5FncSSuHVOS74NdDX5aWlqJn0FWH/P05v//9 Y5lUGj4VnTgbk1Em4BtPTbEhKxfuZA6Z30niZfRnWDHJXBgklhPHMpYve+KeMBY+Eskc ZD4wQpkrl7x49JGFSJ0WzdlTlOy++MjQumRhbenmp/e8Ri6bXnPnHyljLg13UbX6uQKI Bu++dUg5rYojVROAS3tv+Z4GuNTe+NMNQQsmX5VC4qv1BIZ9vO8jvMWv4KO6j8LGVe8U fgOJ2NY1UJDLIyknCuLUvAVWPPw22I2zq+z1okCws+42kSwSkH8jWxjsQVKdYyFUzNY+ MZBg== X-Gm-Message-State: AOJu0YxRceBM/dNNWI5YBUshsild7E+UViYv9q7se00GtGpAiGVMVA96 3oLGaUIxzs+GeLNs0L4kNm5t8O70oJChqOXDSC9HlR5mcJuZfk8jtNOahP3bgT54KptEV/j7EZA or6JcoWo= X-Gm-Gg: Acq92OFeucOAan8/2Q46zwnA59Z0z/5LRk3dQOKdZraT1NLPpZ2mEi3EJ9+pPAQdHKE xC5yCbwB4NP+au/UGP5w5A5ZIGlITG6W4H86xiS5e5W987RFEEpjcK8zoMUDUNVBey3gOaW+xFT E9v4vaDT/icO3NTPRNwErNoMpKx4LJm9E4ULh2Wanyl8qkPyQ/NyR3weCUcdnY5iKGN+Yj1sLyi IX4y5fkyTS1+N0mSBP+esZwpHha2PEpqY58roN+BiuzkTSVTzD6+FKYhdKKFfMaN8PgEfKr3P9r hrsoZmi0lzO1jhQQIVSOxY0s+mFG3eZ/UCqRX9i2K5VQ/qWeWkwYJP19oqJVv6iLFN0P+xLS+KI pkAkayBG9rOTu4DGdKv7IMPNN0/8QcPv6cd6V5PivMGfj7jgMbzLqsgj09Y9MudNl+elBohxVRX OomdeUAmoaPqky0HJWSVRbCgTJJHS7uA26meFqbfPBi8EkyoqP8Q== X-Received: by 2002:a05:6000:4912:b0:446:96b1:f53 with SMTP id ffacd0b85a97d-45ef144bf59mr5210121f8f.26.1780060016626; Fri, 29 May 2026 06:06:56 -0700 (PDT) Received: from linux.fritz.box ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45ef34a037fsm3408549f8f.4.2026.05.29.06.06.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 May 2026 06:06:56 -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: [PATCH v4 1/2] workqueue: Add warnings and fallback if system_{unbound}_wq is used Date: Fri, 29 May 2026 15:06:39 +0200 Message-ID: <20260529130640.220328-2-marco.crivellari@suse.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260529130640.220328-1-marco.crivellari@suse.com> References: <20260529130640.220328-1-marco.crivellari@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Currently many users transitioned already to the new introduced workqueue (system_percpu_wq, system_dfl_wq), but there are new users who still use the older system_wq and system_unbound_wq. This change try to push this transition forward, by warning whether the old workqueues are used. Link: https://lore.kernel.org/all/20250221112003.1dSuoGyc@linutronix.de/ Suggested-by: Tejun Heo Signed-off-by: Marco Crivellari --- include/linux/workqueue.h | 1 + kernel/workqueue.c | 12 ++++++++++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 6177624539b3..a283766a192a 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -409,6 +409,7 @@ enum wq_flags { __WQ_DRAINING = 1 << 16, /* internal: workqueue is draining */ __WQ_ORDERED = 1 << 17, /* internal: workqueue is ordered */ __WQ_LEGACY = 1 << 18, /* internal: create*_workqueue() */ + __WQ_DEPRECATED = 1 << 19, /* internal: workqueue is deprecated */ /* BH wq only allows the following flags */ __WQ_BH_ALLOWS = WQ_BH | WQ_HIGHPRI | WQ_PERCPU, diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 33b721a9af02..0b55f8009eed 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -2280,6 +2280,14 @@ static void __queue_work(int cpu, struct workqueue_struct *wq, unsigned int work_flags; unsigned int req_cpu = cpu; + /* + * NOTE: Check whether the used workqueue is deprecated and warn + */ + if (unlikely(wq->flags & __WQ_DEPRECATED)) + pr_warn_once("workqueue: work func %ps enqueued on deprecated workqueue. " + "Use system_{percpu|dfl}_wq instead.\n", + work->func); + /* * While a work item is PENDING && off queue, a task trying to * steal the PENDING will busy-loop waiting for it to either get @@ -8037,12 +8045,12 @@ void __init workqueue_init_early(void) ordered_wq_attrs[i] = attrs; } - system_wq = alloc_workqueue("events", WQ_PERCPU, 0); + system_wq = alloc_workqueue("events", WQ_PERCPU | __WQ_DEPRECATED, 0); system_percpu_wq = alloc_workqueue("events", WQ_PERCPU, 0); system_highpri_wq = alloc_workqueue("events_highpri", WQ_HIGHPRI | WQ_PERCPU, 0); system_long_wq = alloc_workqueue("events_long", WQ_PERCPU, 0); - system_unbound_wq = alloc_workqueue("events_unbound", WQ_UNBOUND, WQ_MAX_ACTIVE); + system_unbound_wq = alloc_workqueue("events_unbound", WQ_UNBOUND | __WQ_DEPRECATED, WQ_MAX_ACTIVE); system_dfl_wq = alloc_workqueue("events_unbound", WQ_UNBOUND, WQ_MAX_ACTIVE); system_freezable_wq = alloc_workqueue("events_freezable", WQ_FREEZABLE | WQ_PERCPU, 0); -- 2.54.0