From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f52.google.com (mail-wm1-f52.google.com [209.85.128.52]) (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 9461630149F for ; Fri, 14 Nov 2025 14:16:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763129795; cv=none; b=TEwBuMTGhYjrPghuirCu9h+H+fIeXxp0i+6FVmSMFLZ67sLgzhhBQbqktagonFSb5gL83p3IN0OKuKt8Vck+cyrTIuTBVa3rdRHqfXBS0Xp+5X53ulbIS3UClHnbVGJnRSlz0iI10GsnEqleDReTUv4v7Eih+mGvwlGg53Qi1+o= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763129795; c=relaxed/simple; bh=vNFkascY1LyGKHU+9Dupv0zXgX4S3xRNXAt7j+VSeR4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=LAZtYhPCqa5TdtDMNd0vat4qmFVLxH/Vx2hnyoFa/dHgFAVmD1c+ZGBgWvp3ZTikinL64gwvlGp38o2bMzTyVgsHkGTiya39xpWRkcTac98qCVDKfeN7Zw4iBbQjaKv46dj/QiIj68Q4V6qCLrLLlHn0XwSwax2y9a7nYfa6Fbg= 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=OSB4LII5; arc=none smtp.client-ip=209.85.128.52 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="OSB4LII5" Received: by mail-wm1-f52.google.com with SMTP id 5b1f17b1804b1-4710022571cso19473835e9.3 for ; Fri, 14 Nov 2025 06:16:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1763129792; x=1763734592; 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=mQF2Z8P4yFTdZzoKOHCfalGBAcmUCNVEA9vrHYCR8W0=; b=OSB4LII5QDy5ua3MdhiHxzlYfQfczT7bfIbTZBRbVqd11ZoKDAuZZJFEsj7RfmsYBn 6c7l2W8de7lfNZ2c5cTq5UZZjDoGD0/ynb59yiFwNddUMqMhc5/8kypUj6uc9K7N6d/J Z0ygOW1/QSPf0IDZGN4flZHZjrTxdrfsUrYi33imywouC367Po9OfoQ+PRDfNaT4Ki8s tnhoXri8bAVUqO/ZWh0bZ6kCKc90ejuPE1e8TwpHtFC9qfzY64lvqxZwumdyX+RAvNkW pkEY8+Bi4VD9tdL6D9wn9xRxASjKHp984RacsJ7ncDV7+dJTF7JPthvt8euwy8GLaonR I5iA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763129792; x=1763734592; 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=mQF2Z8P4yFTdZzoKOHCfalGBAcmUCNVEA9vrHYCR8W0=; b=mKWAaTvR9TW6qIwZUXpwD62iGbGrW7wcia9e50QcXIefUuYTzju9f+ktDAyd5OQ6ev OrbC9CTW2fS3ahzTirtvMEojYSFgFRwmNeW4ZLT9DQKLnIzv6lTdxDJVsQTftK9dAESV b4TmC/phBrIu3Dp9GMh3mJeSvue6JnCSc76mLp7lrd4fK3ldXAw8Uswgq2I2aXgZI0KX kDx7gLU516FGcWG549119MH8wLq4K1z55sZLAxm7c+KeVL44jMpEdO1+bSaKQo0Dbiw1 Dbbj+FsMwYq6VkNHNoB+Zm5GCrxAduE/i8ImCoC3spJgdbrW/ROjGcfD/NOYW3qw8bKS tHMQ== X-Gm-Message-State: AOJu0Yx/q8iVds8qulKFZkgFUaGQ0U3XdVQPUmJsueyuWMHdrBTqqZTX bKyKgSNOWHYpqLeHulRJBx/cCnMxcoT/BR5YG9yq+Kxg+8vCz1YeK4JVsV1Cj0rxGuDUXUglBUw FE2UH X-Gm-Gg: ASbGnctvK4GzKYVtMqFqmMrk+oNmTknBjbz4RA7ARhsgT9iYwmY/ciTRpXMda4OPCUq Pyc0qy20+Na+D0UzMhBBB09oSzx+C783PrF1NzmVcJlsiZvWMARFvJ4GDLdnOitd2pQLVD7oMkp NAF/X+Y4Y4kC4dIM2RmKRuPxqxKUgFlxqot9t8IgLeTKar+SgPX24ThwVIOfO1pMBPyIQ588TbW HuMqArxw8PlJXqJ+KeK0INp852B0Ih6PJ/kFb9I8s2BuPaiHUR59fd7PAB5HeyWTIFceePkPcwV Vhj0mN20MNiiIp0tGyBkx+pbErozRFyRasmq2C8wBhbSGxHudzSJzrZxutGm7B2Hz8t4z5iufFw jduQWsEScAwvTBCSZY6ZOtfEQjBqwfL26ZXtztA84m9uWKBAw6t2zkv9PGOkGfUKkHnfH5jdiNf 4+JAvj9zrJT0HvxIw= X-Google-Smtp-Source: AGHT+IE46ZnHX5Ml7gMD/j88l/4HK9o8uYdw/H0Sv9oaE6tiTMCu/g1MmdPIoFfXmmh7vI4Qf6v3jw== X-Received: by 2002:a05:6000:400a:b0:42b:3220:93e8 with SMTP id ffacd0b85a97d-42b5939e16bmr3172519f8f.57.1763129791577; Fri, 14 Nov 2025 06:16:31 -0800 (PST) Received: from linux.fritz.box ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-42b53e85e6fsm10425052f8f.18.2025.11.14.06.16.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Nov 2025 06:16:31 -0800 (PST) From: Marco Crivellari To: linux-kernel@vger.kernel.org Cc: Tejun Heo , Lai Jiangshan , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Greg Kroah-Hartman , "Rafael J . Wysocki" , Danilo Krummrich Subject: [PATCH v2 2/2] driver core: WQ_PERCPU added to alloc_workqueue users Date: Fri, 14 Nov 2025 15:16:18 +0100 Message-ID: <20251114141618.172154-3-marco.crivellari@suse.com> X-Mailer: git-send-email 2.51.1 In-Reply-To: <20251114141618.172154-1-marco.crivellari@suse.com> References: <20251114141618.172154-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-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently if a user enqueue a work item using schedule_delayed_work() the used wq is "system_wq" (per-cpu wq) while queue_delayed_work() use WORK_CPU_UNBOUND (used when a cpu is not specified). The same applies to schedule_work() that is using system_wq and queue_work(), that makes use again of WORK_CPU_UNBOUND. This lack of consistency cannot be addressed without refactoring the API. alloc_workqueue() treats all queues as per-CPU by default, while unbound workqueues must opt-in via WQ_UNBOUND. This default is suboptimal: most workloads benefit from unbound queues, allowing the scheduler to place worker threads where they’re needed and reducing noise when CPUs are isolated. This continues the effort to refactor workqueue APIs, which began with the introduction of new workqueues and a new alloc_workqueue flag in: commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag") This change adds a new WQ_PERCPU flag to explicitly request alloc_workqueue() to be per-cpu when WQ_UNBOUND has not been specified. With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND), any alloc_workqueue() caller that doesn’t explicitly specify WQ_UNBOUND must now use WQ_PERCPU. Once migration is complete, WQ_UNBOUND can be removed and unbound will become the implicit default. Suggested-by: Tejun Heo Signed-off-by: Marco Crivellari --- drivers/base/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index f69dc9c85954..40de2f51a1b1 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -4138,7 +4138,7 @@ int __init devices_init(void) sysfs_dev_char_kobj = kobject_create_and_add("char", dev_kobj); if (!sysfs_dev_char_kobj) goto char_kobj_err; - device_link_wq = alloc_workqueue("device_link_wq", 0, 0); + device_link_wq = alloc_workqueue("device_link_wq", WQ_PERCPU, 0); if (!device_link_wq) goto wq_err; -- 2.51.1