From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f42.google.com (mail-wm1-f42.google.com [209.85.128.42]) (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 D80AE1FC110 for ; Fri, 14 Nov 2025 14:16:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.42 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763129793; cv=none; b=UffysYiMh8Tb04tPTk02yER9ap0K71RcHNTLurCJm8nlTZrv8vZEZ+roAxayYADei3iQ/1sYQxIgJ1Wb6jdA+xgT+G5mw9ZAH3MnwEhk4eW5rFlxb51hSxX39aFb6cPY9v7w0VP3mzWNsvtdPelMkuCvhQvozcRuF05lV0/H5wU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1763129793; c=relaxed/simple; bh=caUv2grED7cwvwYXXPnF8x6HuIONyakPIcCdZle4lyY=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version:Content-Type; b=tqN6+Lb8RhqrYW0RCdVFwsz8k74S3lNF8gWhz/moRAkKXrTUZlVadxQ3ApRGrdx5uCeyPhGKm+4zo2YmK6iYdMw3wxDyeHZrkSdokhA1v86EJIqU55rpRgrJdGz+kysNnXxxPoCQhr4cfw/nI6Ybp8gO9c7+FsQVShhqeHGMAYk= 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=LVx7GVWu; arc=none smtp.client-ip=209.85.128.42 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="LVx7GVWu" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-47112edf9f7so10320715e9.0 for ; Fri, 14 Nov 2025 06:16:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1763129790; x=1763734590; 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=6j9zUq7rna+dRzHX1Wi6PtLPqlJ9Z85fpHFdvrDajmQ=; b=LVx7GVWuKzpggWQ+1rZYOr+G8eGLglVHYaM0zM0up570o2WUPByb17ZLz4CaFBAQ88 7z+sEt6kNS7EtzcT4Cn/DQ4y3Rg1cUk5M3+dSYH5ihJ7iuTx4TxvQtuOrCxlavWwEXeM uMwmEuOowM2wfc/ihEaTojoFJroNpjNEnFB9IO1jcmIuqGIrtoVBHY6gUAdCGratpIf7 f7zYnI4bDWg4J7j777hSDS74ge/aoM0IieBNJvuv5gxO/5q5EKeyE0clROEV4nuI3MWI MRyWNLsHRAoJo4kxoy5QN6xPGEodBGbU4RhWszwoQ16FwjDuCPo7R9NnMZLIhPoeANNo 8wYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1763129790; x=1763734590; 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=6j9zUq7rna+dRzHX1Wi6PtLPqlJ9Z85fpHFdvrDajmQ=; b=wFnrC3JEUp712MiBBGHcsMrLzjV+hiXoUDNZu+p5LTfcoV0O4QyVoTz5qf+xYIEYOI Z9iFJ/BiwXRCzQND/F8lnA7aM5TlhNQjuKTHu7GOBBmIgk+sottD3DTkUMlfO4zaW5Fl WRz6xYgvozTypDEyB3deZlylllGP8d55vcHkYFLTa5E2dOwJKOQuKkR/fjDBmdtf9vtU ZEtGHg64RYNBbOsAQYyLsLRQU/pmwkZivHLeHQRimrcWF09MibRvZAI6X3L+CCM06vIp uolpSZSXvBg0qeZvM+7GzTopknJD3+A1xcmNYZovYMQxeHFrvrZzie6LO+NsOXKQTjez XlIQ== X-Gm-Message-State: AOJu0YxaT1Qo/TKnLNOXL/Ntc4PPUeE88WwWVXtRzL/fWATzhJbsbRti vBz3HlkfrCtG8SturAomi98L2vsZ3YixeMR0ayDZv0wCLTySqs2i13bowJgTQ4j1BwAQ6lPTcJY fNv65 X-Gm-Gg: ASbGncsTYMMOmFjh+6EqWGw34JXnexhAAGWei30qvOvn/cpa7E4CiG0vZg6UF12RPsD H2/J8bZ6wc5WdagGrGJbS/wBWIar5Av76WzTZ/zfcEmlKwWKBEjydrVEQ9SpnYFTQjgeyOwkFRZ YnSPBrkqq74L2vDdfB+vNmAauM4yLsbMuHB8Z9bUUje8b0N61TkGkdqYDCihBY0rirXwwFNk0ox UR0KXedohUjSyZnQNlMuWfgAboUr1c5Ql92wjlhr89qKDvTwy9f0L52sLJc9Dy34MUIcX8JY5x+ tgi0Cqe7N6g4n84bLCp01nIv9e6gFfJudf+1lAWEgpufspPil5uSWk5PJS3OyKzRIaKi6XvMg14 /EAAlpfk2pJ23fX4BkvbWV940GJQBOxhFOH6Ywmeg/8tB54WybIlPBSJ+E9u0cQhZToiL9VqziR YsmsnAFu1U2Q4hzcCWa44bR5eI4g== X-Google-Smtp-Source: AGHT+IGynyxNt2DekxhrV4nke6A461Hcc8HrQZiMirLJUKS61pDaZPc/Kxn5ubSYUkDnD9FPv9qhhQ== X-Received: by 2002:a05:600c:45d4:b0:477:df7:b020 with SMTP id 5b1f17b1804b1-4778fe7f6d4mr29911165e9.18.1763129789835; Fri, 14 Nov 2025 06:16:29 -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.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Nov 2025 06:16:29 -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 0/2] replace system_unbound_wq, add WQ_PERCPU to alloc_workqueue Date: Fri, 14 Nov 2025 15:16:16 +0100 Message-ID: <20251114141618.172154-1-marco.crivellari@suse.com> X-Mailer: git-send-email 2.51.1 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 Hi, === Current situation: problems === Let's consider a nohz_full system with isolated CPUs: wq_unbound_cpumask is set to the housekeeping CPUs, for !WQ_UNBOUND the local CPU is selected. This leads to different scenarios if a work item is scheduled on an isolated CPU where "delay" value is 0 or greater then 0: schedule_delayed_work(, 0); This will be handled by __queue_work() that will queue the work item on the current local (isolated) CPU, while: schedule_delayed_work(, 1); Will move the timer on an housekeeping CPU, and schedule the work there. 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. === Recent changes to the WQ API === The following, address the recent changes in the Workqueue API: - commit 128ea9f6ccfb ("workqueue: Add system_percpu_wq and system_dfl_wq") - commit 930c2ea566af ("workqueue: Add new WQ_PERCPU flag") The old workqueues will be removed in a future release cycle. === Introduced Changes by this series === 1) [P 1] Replace uses of system_unbound_wq system_wq is a per-CPU workqueue, system_unbound_wq is to be used when locality is not required. Switch to using system_dfl_wq because system_unbound_wq is going away as part of a workqueue restructuring. 2) [P 2] WQ_PERCPU added to alloc_workqueue() This change adds a new WQ_PERCPU flag to explicitly request alloc_workqueue() to be per-cpu when WQ_UNBOUND has not been specified. Thanks! --- Changes in v2: - improved commit logs - rebase on 6.18-rc5 - removed "devcoredump: replace use of system_wq with system_percpu_wq": now is using schedule_work instead of mod_delayed_work, there are no wq to replace. Marco Crivellari (2): driver core: replace use of system_unbound_wq with system_dfl_wq driver core: WQ_PERCPU added to alloc_workqueue users drivers/base/core.c | 2 +- drivers/base/dd.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) -- 2.51.1