From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f46.google.com (mail-wm1-f46.google.com [209.85.128.46]) (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 92DD6224AF7 for ; Thu, 14 May 2026 09:24:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.46 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778750644; cv=none; b=FdvKz6ygmW1lsM8zltr28XLOgjtG92leLM+iz0/w7ajYEVlVLINxzH4BmuXhlZrOHEQ9eBiCdietfiP7YItDQTJ5GEUVye1bXGtwjnpQXA0hlSltqhgLkw45r9wfs3NnYyFWMJZ48gWrqvbRVKTy20kH7U5ZFm7x18MBlZ5xh4c= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778750644; c=relaxed/simple; bh=YoNcre03qUHD0n8QLPJ6cKq1v4CzGXxf0Bqm5MJj0Ng=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QkSPG1aQstwv3QpFPN8YFEX1MUqKlYZ82b0rerCh990equeQR9T9IAXfiHwhrt7zJFtGwno46Kil3/dt0si5L6x9gvw3hPLhRXsaPJH+ayRbMljpl3ghgsyaK4Y+cZbQ2mF3dUCblpBCNOIpOsbxs2LWPlPV9+8CQm0bjCHzXrU= 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=EJc+NQg6; arc=none smtp.client-ip=209.85.128.46 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="EJc+NQg6" Received: by mail-wm1-f46.google.com with SMTP id 5b1f17b1804b1-488b3f8fa2bso81416625e9.1 for ; Thu, 14 May 2026 02:24:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1778750641; x=1779355441; 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=nBD02UaIEvf9ZnfAxsQA0cWzOXqaq89BocgSxOYnLZM=; b=EJc+NQg6r5DroYHonBD5ft+higNBJqLpVTY82znlSZO9jMFuD+wYoXU7ydy5OplXBb NCS8UvKlgJBFQhV21qLjATFVb7xGjHV6R7BC+cDNXY1UDqcl2uecYkhPYtLdPSEDCLmh Nf17hqrW0CPBEL2dRRjzA9ZtR/EhwSTcSJCtYjxhkqXgkTCDQQlbW1a0H565kOSdoiH/ 47w2wJPFCODUvBobwwIU977FQZukdH246YLJAiFHCHc+tiPtNuuDfzf01PDzL0hwmuAe xOa2gQ5SC50c2kJhCIyvi7UtDgfXchjVZctXvcBsqX2+wnI/LHqUrci4K9vccX5MIe7w ANyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1778750641; x=1779355441; 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=nBD02UaIEvf9ZnfAxsQA0cWzOXqaq89BocgSxOYnLZM=; b=h9OwTwWejoGI8+quVQZeE4Ei429SFEZKjJmzl6W88oxe21ic6Et+/SlTIbP6oTzqlm C2qJW4bkT5lo9Z0FT35b9gEX9QBCkUtcWf15ljpmnA1R5pzDfL9zkzkcqJOAdZlsUo5W HhyWeWON4xe+rWV4vNBh01q8dCq1svMaJmjE7YGIwqau+aSECQ23TmCmXYfZjl+/XSPy oyGyubfmSmJnm/9y9zIkn91HrfhQWs0+ukmYx9YaWw7uB60HozPXsXaI8GfsHdXi7C6b wR009DH9iQQRod6p0uSH/vvl+rmTpVQl1vjbvarWyuJ2ZvV2dQxBz/n3lHf668h3Tpv6 tScA== X-Gm-Message-State: AOJu0Yzx0fX1fys6mYAuzOfDPEjTq7fpa4Do1DTIHaF4i8BlvKmwwdhv QlDv7rsfgbCZzyvXXqsJ2SQ0fTjsRKac1dVAa839VRf3JgQrDVf5S29zC6idJGmXB0KYf5E51gy AnAen4ZI= X-Gm-Gg: Acq92OGdAIqUbfujiloirEhazgaAyjPyCoJRawIq5qw3RO8zRokNYwfpRsFj1PfKrLM h6f2/nrFyDPjQ59vVFeqzcNdf48/u1TpdgcLcbGQIcABxM+4Mq4+5e1pWM3wKKMUu8ilkt5j0w7 yLsGZ+DGCqR3TTGfRyte76KgqxJVR/g25JelUXG3tVgJx+uQ1b7vK94jI/w3CLPf0lPYlO+9aCR y8hLU391JbySjqgOW+p4q+xuq2YvlrbRpqULDYWKVN4yrwyjMIC8ASqpe/yJ2dJmL61iu1REIlh mj+0/iPySvQcZeVdJuDS/ZAdpItwl3iESUNPH/gJzhZBdFFuEOQONFDlLeWHa7yr9EcNiQPALp/ orXB0v4nc63cJ4Tv16qW3EO1rt5fIwh+ucqP/2Rg4uUgDXPyoX2oOc+x4gHaFxUMpJ9gfGmdrvW Gu9t6Wzd4CClZ/oTtXqgFm7Rs4Acl3lEcNnzYl9zMsWnhwUhE= X-Received: by 2002:a05:600d:8450:20b0:488:7d01:f67b with SMTP id 5b1f17b1804b1-48fd6333288mr33907695e9.6.1778750640773; Thu, 14 May 2026 02:24:00 -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.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 14 May 2026 02:23:59 -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 1/2] workqueue: Add warn and fallback if system_{unbound}_wq is used Date: Thu, 14 May 2026 11:23:53 +0200 Message-ID: <20260514092354.125149-2-marco.crivellari@suse.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260514092354.125149-1-marco.crivellari@suse.com> References: <20260514092354.125149-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 workqueus are used and redirecting them old used workqueue with the appropriate new one. Link: https://lore.kernel.org/all/20250221112003.1dSuoGyc@linutronix.de/ Suggested-by: Tejun Heo Signed-off-by: Marco Crivellari --- kernel/workqueue.c | 54 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index 3d2e3b2ec528..80d9c91ae606 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -2425,6 +2425,24 @@ bool queue_work_on(int cpu, struct workqueue_struct *wq, bool ret = false; unsigned long irq_flags; + /* + * NOTE: These checks are here to assure that no users will still + * rely on system_wq and system_unbound wq. + * They can be removed along with those workqueue when the + * time comes. + */ + if (unlikely(wq == system_wq)) { + pr_warn_once("workqueue: system_wq will be removed shortly. " + "Use system_percpu_wq instead. Caller: %ps\n", + __builtin_return_address(0)); + wq = system_percpu_wq; + } else if (unlikely(wq == system_unbound_wq)) { + pr_warn_once("workqueue: system_unbound_wq will be removed shortly. " + "Use system_dfl_wq instead. Caller: %ps\n", + __builtin_return_address(0)); + wq = system_dfl_wq; + } + local_irq_save(irq_flags); if (!test_and_set_bit(WORK_STRUCT_PENDING_BIT, work_data_bits(work)) && @@ -2592,6 +2610,24 @@ bool queue_delayed_work_on(int cpu, struct workqueue_struct *wq, bool ret = false; unsigned long irq_flags; + /* + * NOTE: These checks are here to assure that no users will still + * rely on system_wq and system_unbound wq. + * They can be removed along with those workqueue when the + * time comes. + */ + if (unlikely(wq == system_wq)) { + pr_warn_once("workqueue: system_wq will be removed shortly. " + "Use system_percpu_wq instead. Caller: %ps\n", + __builtin_return_address(0)); + wq = system_percpu_wq; + } else if (unlikely(wq == system_unbound_wq)) { + pr_warn_once("workqueue: system_unbound_wq will be removed shortly. " + "Use system_dfl_wq instead. Caller: %ps\n", + __builtin_return_address(0)); + wq = system_dfl_wq; + } + /* read the comment in __queue_work() */ local_irq_save(irq_flags); @@ -2630,6 +2666,24 @@ bool mod_delayed_work_on(int cpu, struct workqueue_struct *wq, unsigned long irq_flags; bool ret; + /* + * NOTE: These checks are here to assure that no users will still + * rely on system_wq and system_unbound wq. + * They can be removed along with those workqueue when the + * time comes. + */ + if (unlikely(wq == system_wq)) { + pr_warn_once("workqueue: system_wq will be removed shortly. " + "Use system_percpu_wq instead. Caller: %ps\n", + __builtin_return_address(0)); + wq = system_percpu_wq; + } else if (unlikely(wq == system_unbound_wq)) { + pr_warn_once("workqueue: system_unbound_wq will be removed shortly. " + "Use system_dfl_wq instead. Caller: %ps\n", + __builtin_return_address(0)); + wq = system_dfl_wq; + } + ret = work_grab_pending(&dwork->work, WORK_CANCEL_DELAYED, &irq_flags); if (!clear_pending_if_disabled(&dwork->work)) -- 2.54.0