From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 04D7039B4BF for ; Wed, 8 Jul 2026 13:59:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783519143; cv=none; b=OOsAi/MPfUedCEHJxC3G/4KbQmsrPaBHMZwoqPqUJ2igm2Ze3ulVOVlVYMM7C1DCnx07M4UY/oNcQ7bZ2ajlAnugzCrYBb4tC4kFqi7hiVnsWBIIF4+vz3jXplWzYr0z5+fY87MSKqqZg3iqOCiquHH6C46Gq31Mor4k3RxtOg4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1783519143; c=relaxed/simple; bh=EQX7GarmXGsMlTIJUhO29eC/cuuayNGbhIOda3WNnjs=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=S3vh6LgNtx6ajt7Ab5Ng/ziWguyEVxK9WmxOXkz36cXD1YRQR4AMySmiBApoEAsZYPI3aXzeTly01YqVmmM2bF8fDEUN5y/u09pNXvVQARLvOdAYLFA7QeE7EhFZnRqa9VjIHh6yx5iIxneGTGFbHVJcN7ZJ/cIykxDGj8KxCgQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dWBblXga; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dWBblXga" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 09EA51F000E9; Wed, 8 Jul 2026 13:59:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1783519141; bh=qaI+saaR+eIFggDBYgh5Lo6Q/n0x6OUBP4sl3ui68Z8=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=dWBblXgaeHm9gs8m/nqGssQRugQlTrSn+lnJKXY76zmZlcWUL0LCeKCZ7qwEhAeJi LaSHrJJERVmwWZJ0hGnXavm5LipugJA9uDITMcvebnMeWbus3eoiz6dE0eEcPC/+eP ODjlmHLpiP+pN0TBg5uEzL81cQi90UJ4XC1yNUrWRrNthlTZ27lsI+dygN1vT0cAIV tGpNY00oEnDYq4wBybV2lL+6QioTozSuQysPT+i8s9VHGD0hdLuWAwwG0lEdnyEvlD 9pinC9Bp8KVPt0IqaKxnoKcXwAmddTzAhTtBzptjz7fcvBGyZzLkStPl6PHMDxYidF ZgT0n+b7IRJAA== Date: Wed, 8 Jul 2026 15:58:58 +0200 From: Frederic Weisbecker To: Tejun Heo Cc: Marco Crivellari , Breno Leitao , linux-kernel@vger.kernel.org, Lai Jiangshan , Sebastian Andrzej Siewior , Michal Hocko Subject: Re: [RFC PATCH 0/2] Add queue_*() functions and prefer per-cpu workqueue and flag Message-ID: References: <20260505161658.401998-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=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: Le Wed, Jun 24, 2026 at 09:46:55AM -1000, Tejun Heo a écrit : > Hello, > > On Tue, Jun 23, 2026 at 05:13:31PM +0200, Marco Crivellari wrote: > > > - At boot time, allow selecting whether to back them with percpu wqs or > > > WQ_AFFN_X unbound ones. Maybe we can even experiment with default to > > > WQ_AFFN_CPU. > > > > You mentioned here "at boot time". What about making this also dynamic, > > "moving" the WQs with WQ_PREFER_PERCPU away from CPU N when N is > > isolated through a cgroup isolated partition? > > Yeah, being dynamic is better but switching dynamically between percpu and > unbound workqueues feels like it's going to be complicated. I can't think of > a simple way to do that. If you can, please be my guest. I fear it's necessary to have dynamic isolation working correctly. One way could be to make wq::cpu_pwq point to a pair of pwqs. One for the isolated -> unbound configuration and another one for the non_isolated -> per_cpu configuration. Luckily it's fetched under RCU, so we can have that on one side: housekeeping_update() rcu_assign_pointer(housekeeping.cpumasks[HK_TYPE_DOMAIN], trial); housekeeping.flags |= HK_FLAG_DOMAIN; // for housekeeping_enabled() synchronize_rcu() flush_workqueue(wq_prefer_percpu); // flush both wq->cpu_unbound_pwq and wq->cpu_pwq And that on the other side: __queue_work() rcu_read_lock() unbound = false; if (req_cpu == WORK_CPU_UNBOUND) { if (wq->flags & WQ_UNBOUND || (housekeeping_enabled(HK_TYPE_DOMAIN) && wq->flags & WQ_PREFER_PERCPU)) { unbound = true; cpu = wq_select_unbound_cpu(raw_smp_processor_id()); } else { cpu = raw_smp_processor_id(); } } if (unbound) pwq = rcu_dereference(*per_cpu_ptr(wq->cpu_unbound_pwq, cpu)); else pwq = rcu_dereference(*per_cpu_ptr(wq->cpu_pwq, cpu)); ... rcu_read_unlock() Thanks. -- Frederic Weisbecker SUSE Labs