From nobody Thu Oct 2 06:21:39 2025 Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com [209.85.128.54]) (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 592DE1F3FEC for ; Fri, 19 Sep 2025 14:50:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758293457; cv=none; b=L/w6P275PaFuQREg3tsqSm5GNCPpdK7Doz3cWrAKHPTy3pt8NM/GpxsKKU9sjbBMjBXKVFqnD0I0AR+nGhoVvOKFlnGEPvxcnLCtGelEPUi/Tb+Keb/7hvd/oyokgiUk+993QIkLZZb15QjQkq79OJUMIbVwnfeZcJ8Z9oVKcqY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758293457; c=relaxed/simple; bh=IYbkaDSJK/MsI08RUb+i/WJqEc72qtzOPNCB6tRbT5s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Bj5XJBzEyKc7JtpTo9c7ytxajO4Mkoym+bVLPdPoRs+O+vs55DPttf8BxK/Q1z3Ya+/D89rPBRhalbs1KM7heC9YzuQuVgEXo/oqEPUeMPzLc4UpMeO0Xc2VH8/ilwLkCDBXPDxfNBqo/6+Dq2vAlLnH+qlTWGGApvKNlJboRYg= 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=Ahlfsqkz; arc=none smtp.client-ip=209.85.128.54 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="Ahlfsqkz" Received: by mail-wm1-f54.google.com with SMTP id 5b1f17b1804b1-46897c60e38so5060455e9.0 for ; Fri, 19 Sep 2025 07:50:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1758293453; x=1758898253; 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=a39diFNJWgxr3FQyapz8HaQx19r+VVUG7JQzrSi4iDw=; b=AhlfsqkzImZGqPXFSfs7cHxQdbxCe+dlWHDgZQXTiJtKjPstSgNVLp+FeZCUll7L/s cRywaJD2ovk8jRPojmcpNVcYotLPob7qjQlqVrgXFtPfFv8m6QmW2+aoUqkwLCOeXLRL E7lDSBmcoYVHf0n6uxZstM9YMoeyVrVp+JdvafkJqsTxCqjOilTOV3t3V+i8JYDRbNY9 oNhnMo57ZScdo67GrIiOk5WiQwbk3+GTgdjhfFC/6qLOUsiY1/R/hVuP99Jr+x5I4ChA 9L39jGzlncwYhPJAyJjMBzL2vgpmzYQ1kRueD/hwQnXROAhJExmhWHS2G01TRbDmv6FM LWKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758293453; x=1758898253; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=a39diFNJWgxr3FQyapz8HaQx19r+VVUG7JQzrSi4iDw=; b=ayzP2F2KZXcLXwMRm/D5cXKwFoxvs47P8mtyAU2N6wCX/0XN7lisUsoIbVDzw9mpK/ AYQDePWk91S0bgzh2I5VMA2KHhavoBynj3jom2yGANTvgerh4FaRWImLz/j2KIgY05TS YRIyDYDWvsp0amZtNhMtUAEzoUOzkgzjF9icpcsRVrMcEcRW4DPIrWG6MHfHPjUQdTsP CNOPYN/bebOiO7JvHwS1ezomoaZNi9jhJuApDEP7RnI2A1pl/6b3NBir6kq6frgItieu Zm2z4D3vHxfI94gN4yAcnHCKNPDg5PIh/JTGobc0rDLe84h5Zv47t4JMoOXxT58v56t+ IjPg== X-Gm-Message-State: AOJu0Yyg+a2me6mhPHpeq4RoOQ8JwM8kf43VSSUbMqTbG8lYRpoQSfNx VSOVyA/FghQubDM/Ll0x1JG0CrQ1JBWF4N5zNhHdRzJDRxu7+YfdCI70qJ4KGSLsRMcNjCGLjZq 0CrMp1L0= X-Gm-Gg: ASbGncsFdcMC4473YtpGq30rGz1CyjTc/6+NxpzBOCM1GS38o9jE57ufzB27dI68hw2 0zoRuCDAibU/smU4ujrys93iBuCHZ0a57pzXj6xzFn5XAqCYsILMvQQx4cGfetS4ZatjbGjrwIA kH7UTGVoEVVMTS+Q6bHnVMPkWIzgobDTn3wMNqioykh3lXVsR5cpw/NAo8NMT+tyf161PrPWx5e wIhysy3h4yUYKE6a5xra2K/baaJiPNiZ1nj54Jw/oouCcPKEIPsBRfzqTXpSc0qiLamKB8vV9El bP7UiR+NvctsJwl3jrRy0mLsrpPASxLKaJTr+wzPtl1Wfi11xBil3yb6QqXac7me+Exvm5lz9R2 yj9IPKTz7PMaweHJ0k1inz61h941HaawavOEhOOhUDCzJng== X-Google-Smtp-Source: AGHT+IErceu7QLWloEQH2lrNBaTxdD2XPLeNYqSyKYD6Djjy3eEcDH4Pl0dN11iIdw/d6podUBIkrg== X-Received: by 2002:a05:600c:4f46:b0:468:7f92:5a80 with SMTP id 5b1f17b1804b1-4687f925e16mr26453175e9.27.1758293453266; Fri, 19 Sep 2025 07:50:53 -0700 (PDT) Received: from localhost.localdomain ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45f325c3c29sm86220025e9.3.2025.09.19.07.50.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Sep 2025 07:50:53 -0700 (PDT) From: Marco Crivellari To: linux-kernel@vger.kernel.org, rcu@vger.kernel.org Cc: Tejun Heo , Lai Jiangshan , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Jens Axboe , "Paul E . McKenney" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki Subject: [PATCH v2 1/3] rcu: replace use of system_wq with system_percpu_wq Date: Fri, 19 Sep 2025 16:50:37 +0200 Message-ID: <20250919145040.290214-2-marco.crivellari@suse.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250919145040.290214-1-marco.crivellari@suse.com> References: <20250919145040.290214-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: quoted-printable Content-Type: text/plain; charset="utf-8" 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 consistentcy cannot be addressed without refactoring the API. system_wq is a per-CPU worqueue, yet nothing in its name tells about that CPU affinity constraint, which is very often not required by users. Make it clear by adding a system_percpu_wq. The old wq will be kept for a few release cylces. Suggested-by: Tejun Heo Signed-off-by: Marco Crivellari Reviewed-by: Frederic Weisbecker --- kernel/rcu/tasks.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/kernel/rcu/tasks.h b/kernel/rcu/tasks.h index f92443561d36..2dc044fd126e 100644 --- a/kernel/rcu/tasks.h +++ b/kernel/rcu/tasks.h @@ -553,13 +553,13 @@ static void rcu_tasks_invoke_cbs(struct rcu_tasks *rt= p, struct rcu_tasks_percpu rtpcp_next =3D rtp->rtpcp_array[index]; if (rtpcp_next->cpu < smp_load_acquire(&rtp->percpu_dequeue_lim)) { cpuwq =3D rcu_cpu_beenfullyonline(rtpcp_next->cpu) ? rtpcp_next->cpu : = WORK_CPU_UNBOUND; - queue_work_on(cpuwq, system_wq, &rtpcp_next->rtp_work); + queue_work_on(cpuwq, system_percpu_wq, &rtpcp_next->rtp_work); index++; if (index < num_possible_cpus()) { rtpcp_next =3D rtp->rtpcp_array[index]; if (rtpcp_next->cpu < smp_load_acquire(&rtp->percpu_dequeue_lim)) { cpuwq =3D rcu_cpu_beenfullyonline(rtpcp_next->cpu) ? rtpcp_next->cpu = : WORK_CPU_UNBOUND; - queue_work_on(cpuwq, system_wq, &rtpcp_next->rtp_work); + queue_work_on(cpuwq, system_percpu_wq, &rtpcp_next->rtp_work); } } } --=20 2.51.0 From nobody Thu Oct 2 06:21:39 2025 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 7ABDF3148D4 for ; Fri, 19 Sep 2025 14:50:56 +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=1758293458; cv=none; b=QNiOupiGmn4CpUPgDVKY+enHOwtThiFOhhal7fj4LqHt4HuU9XjzAxRiMnCdGMMJkaKzXgnHldgmZbSflIV8HMnCq74LezOtAkuK8c6F+amQFQZPIWVaFP3ubGkZzTk/M5ycA3T/pgWW5bOg9+Lf/SfWUDleqdDpEVi18WOvdj0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758293458; c=relaxed/simple; bh=PV1pAIQ5r/c1M5gMZ2HohN1y5CIC3ZVhLK658XfNPxw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=AqJ1AOHha9j0aL85L2fkXiLXtmdeP6CliMq3ZDoTv54VzpiWJd/LVYANhKj4mSOc9EaTRrN47z/qP4Gc49rx4wFg7JXgyoQOwVl4wf3ux/TYxXUJIEuiKzXk75Fo7NFqTdKWyFdnuQW/b1+2Xoyo49qGLV0CnppDylT68UMb6AE= 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=A1+fIz8n; 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="A1+fIz8n" Received: by mail-wm1-f42.google.com with SMTP id 5b1f17b1804b1-45f29e5e89bso25274145e9.2 for ; Fri, 19 Sep 2025 07:50:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1758293454; x=1758898254; 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=f7KPemB2n/F5BC+EkjNbWfvGZs7MphH30xFCVibraPw=; b=A1+fIz8nzWUpGNFVF49sR1dEHw6QDb7EpaKwIDXcuZicKM2wfWdTgyh6v0G/+SwgSw N5VpQczXeXYQtz9O0LmzLKSri5Vn7NHblJ/owXuOk88EAdx+1YmxPV9sMiTF4nCYE62X JGdQluOJ89dfdWNRTjgjjkCVa9YU/zY3KmjtjFV2s/EhH24Vna9+vzEMn9cKjhpw26uf +v2EKa6s9smKQ3QVVMzXJMJvaa3PqCRl3jNCekRt60mGCNBwNGuqfXDqgvqFAZlsbHrE PuFdPL4ZaSblvblXqHjXcDxb935ZyOQZNGGk0wt2uWBqTEXByy5hfyFzEREeTopazOA4 5TLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758293454; x=1758898254; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=f7KPemB2n/F5BC+EkjNbWfvGZs7MphH30xFCVibraPw=; b=PxCLHqHse9zDhCYoBrGHG6ZQjE/iFZ+f8b70n29eveArpbcwKnkOO1Xwi6STUQJjTm 2qcHsV/uO5BIyzsLXeCBwQCJ2wscA5U61jd6lNqQWzauGNd/utZpeIJCmQZW+Xrd1X6s 3GImW9dXU+zCo0FWUf01FdbK+O3XPtRYbB/+k5XT7mtUSUgBZJtgFUtN9Dz/6t22Q8+Z /pVYuHOQ12KpUKtu7fs0JhFvM/6RWafXhMFm7CfTtv0shQsAy3QWtm2ERD45SRghU5iZ BpHQKwCP1ncUPBQxL9P6hc2lP4AtxNcACfLiMitmIFR33mOGqs21WamfOsz+jrltwTpb 1Kgw== X-Gm-Message-State: AOJu0Yzut38UPmSXeYsVWK5+k1PREFHBWPks1wO9LERyrEiEmAElqBMv BtX8hB5rGVj5D8I7/kultPGs1euWZicPFfj9dj+JghdaHnil12qmnGU9WC03c5GV8O93JLIXJuu Ceo66D6w= X-Gm-Gg: ASbGncvc+dYiyVcW3CpabhMWtd5Gk2NwfRbJOK0HiWxxYFnbMCHkbujdnPIgMhLPG58 Oq6OXu4Dkhcu+jJNTDI15cIliozs+RMhQ3NloKfvwd80eT9iynMpqQYWONBQOvfRa9PsU7WmiN8 WyuWufdkr1PobgVoBc56CUij3LM6U85S0TBzaXSOZ5dD5AK9ev1/FNRG6kUFEAiAa45crboCN+A pm9wvkLf1DjDgKc8rlNdMlK2zl2IeBF2agFFrELJV7rqXzlKWtyY6RIPcXUJasypMIkTogpOmmr WVg2WGY3oEm8/C2tG0yqSF5cW9zfv7ASxqXgtYBvRsdGeS/DeJcD8L/tUTDdj64+K7aVNEjbeBg biWY0NkjiZMOgTxB4dblWdoAUosfNOVVOz10Sh6woQbbh0g== X-Google-Smtp-Source: AGHT+IF9CraP+MLmX7L2E45ETGVlK7VJDOImtYV8q1ZaMup6tdlxqtMY+0E+owqXOtOkfQashquiyA== X-Received: by 2002:a05:600c:470a:b0:45f:29e4:92ff with SMTP id 5b1f17b1804b1-467ea89daccmr39463245e9.17.1758293454299; Fri, 19 Sep 2025 07:50:54 -0700 (PDT) Received: from localhost.localdomain ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45f325c3c29sm86220025e9.3.2025.09.19.07.50.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Sep 2025 07:50:54 -0700 (PDT) From: Marco Crivellari To: linux-kernel@vger.kernel.org, rcu@vger.kernel.org Cc: Tejun Heo , Lai Jiangshan , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Jens Axboe , "Paul E . McKenney" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki Subject: [PATCH v2 2/3] rcu: WQ_PERCPU added to alloc_workqueue users Date: Fri, 19 Sep 2025 16:50:38 +0200 Message-ID: <20250919145040.290214-3-marco.crivellari@suse.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250919145040.290214-1-marco.crivellari@suse.com> References: <20250919145040.290214-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: quoted-printable 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 consistentcy 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=E2=80=99re needed= and reducing noise when CPUs are isolated. This patch adds a new WQ_PERCPU flag to explicitly request the use of the per-CPU behavior. Both flags coexist for one release cycle to allow callers to transition their calls. Once migration is complete, WQ_UNBOUND can be removed and unbound will become the implicit default. With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND), any alloc_workqueue() caller that doesn=E2=80=99t explicitly specify WQ_UNB= OUND must now use WQ_PERCPU. All existing users have been updated accordingly. Suggested-by: Tejun Heo Signed-off-by: Marco Crivellari Reviewed-by: Frederic Weisbecker --- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 8eff357b0436..4f3175df5999 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -4885,7 +4885,7 @@ void __init rcu_init(void) rcutree_online_cpu(cpu); =20 /* Create workqueue for Tree SRCU and for expedited GPs. */ - rcu_gp_wq =3D alloc_workqueue("rcu_gp", WQ_MEM_RECLAIM, 0); + rcu_gp_wq =3D alloc_workqueue("rcu_gp", WQ_MEM_RECLAIM | WQ_PERCPU, 0); WARN_ON(!rcu_gp_wq); =20 sync_wq =3D alloc_workqueue("sync_wq", WQ_MEM_RECLAIM, 0); --=20 2.51.0 From nobody Thu Oct 2 06:21:39 2025 Received: from mail-wm1-f49.google.com (mail-wm1-f49.google.com [209.85.128.49]) (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 96DFC27E1DC for ; Fri, 19 Sep 2025 14:50:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758293459; cv=none; b=MaIYFsHWsr1xn8Rc8i9AHmWgdladt3HqrYFeBJkuoZlAcKT4W3TQMbTqnXGDcaXHQg0xzwE4CWR7obY/bK2vJgiY4uXX5NOHBaFCjQxjgtrn9Q3d8KoidFAGPJvtgNRSRmun5w4u8t22K3DLwZEdt4aFbcA3r7+e5gx6oYfBh7U= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1758293459; c=relaxed/simple; bh=gxbhOQrPen8wXKKo+NB3/QzXDeT+XwtG3U0ZszLmnqY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=PwjiyW1tH1PyMbu6ZQZfCbgneYlH9l+R78tlghyCbxXWLpBYs7Z0b2yx/laPy8u/bEafvNu1RY88eP7Rnsd5GZb4M4jLsILkFh3jPma+eW4+KziTWpI1eSyXD4n0oEpRif0TvK4daCurUzL2MOp3FA4KrFfJgUin2Ik2M7FHY9o= 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=T+qr0ugk; arc=none smtp.client-ip=209.85.128.49 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="T+qr0ugk" Received: by mail-wm1-f49.google.com with SMTP id 5b1f17b1804b1-4687b41fb56so5029605e9.1 for ; Fri, 19 Sep 2025 07:50:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=google; t=1758293455; x=1758898255; 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=40YxYjMQup45mLrxpuaYiZa8fGkstQxo+I8VLpAXNI4=; b=T+qr0ugk70YwdKvPfk9ICGCJu2VGhgAwQSm8BVw187rNp6cQJWHSYo9/IjOYNUrkIS RCSTWICvLp1Haa5+KyYJb1ACKw26rNFW47kvXmDOa1AYK+1e4jQEr0cmaLIv9NlaMD5c zrjTJlODCTmO9w7yhJf+sY30xUhDN6L3RhOaipugvpuCPuEf9KQGLd3gEtWAG+o2bSMH jN/CnvAtzOpqTY/SPBBMuDOrJ3fewuP5bWgUXs9ZgB53HBaJQ+287GCaAunEtCttkzsy oARxWjYWG1zqjZZumyRxbiPLJLApGjNucI8i1VVj5V9waMz+E/RuclxPHQZX2Iurl3ux r/Pg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1758293455; x=1758898255; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=40YxYjMQup45mLrxpuaYiZa8fGkstQxo+I8VLpAXNI4=; b=PjcJREl9CwLNdw2qQy49wo+ryFci+legxfkwDcrrz/I1GNTVWpevGQLRmYJSs3ErJb pQN+zPFjTymbUjz7SsQBYLi0yTOq02YZ4W6QN43eSDGARqfKPeRe+mBxutc6IKUYLj8I 2iLRmL8XpFVRGfCov6bJUndm9plz3hko73yjX/Ya1RUj+Z1r5xC7twbsT+vqDmFxXQ9b naTnN1q3VUU0+jt5wFxndfg7XH4hlRQqAGA2BiJVbY+1bUZcitjnI4gvrbDturke1Abl 81XP1l4OCZlbNb/DFoR47WiiklWuVa7t5BLFbX1DoijIylU4CFNFBS13z9D3AsNYUyWm oFgw== X-Gm-Message-State: AOJu0YwOhcmUpflNcPBXjjS+ARGwiAvfmfhYL8cUpOelPizE2Tt9+LMj p9hDprdYMn03UVUxZXjReZ7pK7VCZMZUjmyzADeS342PKAweNG+WVIxZBX6q8xtJZTUJpWfXgZv I1QIggbI= X-Gm-Gg: ASbGncvB37wYviAlYd1xAi6drBnBWE0xuQoYhSMlonyoHdmOip2yS3vCWL3ESMIPSDI 0RTToG9qu/rM0oMKsaHCWjumMgd5u/WyQIx4bXwZS3hOotMC3OH33JX7URz31f+O0CgZOOKTAIi TX215en12FjEnD/QGTEdjtfuXUahtPfjyr4B5WQ3+hvzez7O/Clr8reyPOoXNqY6leNQmHWJvaG /PajDkqSBLwPYAZW+nryl9aBW3tHtjoEAZxQprzntiHp45F2Qf7RGhzG2Iq5ZOWD2aZolwqzPB3 bzsBkec7spk+ivFKK8/rmOkbGbq+CU0Z2iF6ApwLDqjkTXLYC9IeImMn25QhbZcJz3lDZANkttj H5ATfkjzdRaz0ivlMmrdNYIc/iHDTuIJ9XUt8MSMJ32kNEg== X-Google-Smtp-Source: AGHT+IHkEMZj8HTcCDLW+vs6fkV5ZntKhREeBeWZ6imHtnsAopavxOz9v2VSd5+jLowSXBfeWYQeAw== X-Received: by 2002:a05:6000:2881:b0:3ea:87f8:da4e with SMTP id ffacd0b85a97d-3ede1d9f615mr6312213f8f.29.1758293455313; Fri, 19 Sep 2025 07:50:55 -0700 (PDT) Received: from localhost.localdomain ([2a00:6d43:105:c401:e307:1a37:2e76:ce91]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-45f325c3c29sm86220025e9.3.2025.09.19.07.50.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Sep 2025 07:50:55 -0700 (PDT) From: Marco Crivellari To: linux-kernel@vger.kernel.org, rcu@vger.kernel.org Cc: Tejun Heo , Lai Jiangshan , Frederic Weisbecker , Sebastian Andrzej Siewior , Marco Crivellari , Michal Hocko , Jens Axboe , "Paul E . McKenney" , Neeraj Upadhyay , Joel Fernandes , Josh Triplett , Boqun Feng , Uladzislau Rezki Subject: [PATCH v2 3/3] rcu: WQ_UNBOUND added to sync_wq workqueue Date: Fri, 19 Sep 2025 16:50:39 +0200 Message-ID: <20250919145040.290214-4-marco.crivellari@suse.com> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20250919145040.290214-1-marco.crivellari@suse.com> References: <20250919145040.290214-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: quoted-printable 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 consistentcy 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=E2=80=99re needed= and reducing noise when CPUs are isolated. This change add the WQ_UNBOUND flag to sync_wq, to make explicit this workqueue can be unbound and that it does not benefit from per-cpu work. Once migration is complete, WQ_UNBOUND can be removed and unbound will become the implicit default. With the introduction of the WQ_PERCPU flag (equivalent to !WQ_UNBOUND), any alloc_workqueue() caller that doesn=E2=80=99t explicitly specify WQ_UNB= OUND must now use WQ_PERCPU. Suggested-by: Tejun Heo Signed-off-by: Marco Crivellari Reviewed-by: Frederic Weisbecker --- kernel/rcu/tree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/rcu/tree.c b/kernel/rcu/tree.c index 4f3175df5999..7137723f8f95 100644 --- a/kernel/rcu/tree.c +++ b/kernel/rcu/tree.c @@ -4888,7 +4888,7 @@ void __init rcu_init(void) rcu_gp_wq =3D alloc_workqueue("rcu_gp", WQ_MEM_RECLAIM | WQ_PERCPU, 0); WARN_ON(!rcu_gp_wq); =20 - sync_wq =3D alloc_workqueue("sync_wq", WQ_MEM_RECLAIM, 0); + sync_wq =3D alloc_workqueue("sync_wq", WQ_MEM_RECLAIM | WQ_UNBOUND, 0); WARN_ON(!sync_wq); =20 /* Respect if explicitly disabled via a boot parameter. */ --=20 2.51.0