lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <aXnymtIZSc-fw1b8@localhost.localdomain>
Date: Wed, 28 Jan 2026 12:27:22 +0100
From: Frederic Weisbecker <frederic@...nel.org>
To: Michal Hocko <mhocko@...e.com>
Cc: LKML <linux-kernel@...r.kernel.org>,
	Michal Koutný <mkoutny@...e.com>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Bjorn Helgaas <bhelgaas@...gle.com>,
	Catalin Marinas <catalin.marinas@....com>,
	Chen Ridong <chenridong@...wei.com>,
	Danilo Krummrich <dakr@...nel.org>,
	"David S . Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Gabriele Monaco <gmonaco@...hat.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Ingo Molnar <mingo@...hat.com>, Jakub Kicinski <kuba@...nel.org>,
	Jens Axboe <axboe@...nel.dk>, Johannes Weiner <hannes@...xchg.org>,
	Lai Jiangshan <jiangshanlai@...il.com>,
	Marco Crivellari <marco.crivellari@...e.com>,
	Muchun Song <muchun.song@...ux.dev>,
	Paolo Abeni <pabeni@...hat.com>,
	Peter Zijlstra <peterz@...radead.org>, Phil Auld <pauld@...hat.com>,
	"Rafael J . Wysocki" <rafael@...nel.org>,
	Roman Gushchin <roman.gushchin@...ux.dev>,
	Shakeel Butt <shakeel.butt@...ux.dev>,
	Simon Horman <horms@...nel.org>, Tejun Heo <tj@...nel.org>,
	Thomas Gleixner <tglx@...utronix.de>,
	Vlastimil Babka <vbabka@...e.cz>, Waiman Long <longman@...hat.com>,
	Will Deacon <will@...nel.org>, cgroups@...r.kernel.org,
	linux-arm-kernel@...ts.infradead.org, linux-block@...r.kernel.org,
	linux-mm@...ck.org, linux-pci@...r.kernel.org,
	netdev@...r.kernel.org
Subject: Re: [PATCH 03/33] memcg: Prepare to protect against concurrent
 isolated cpuset change

Le Wed, Jan 28, 2026 at 09:45:03AM +0100, Michal Hocko a écrit :
> On Tue 27-01-26 13:45:06, Frederic Weisbecker wrote:
> > Le Mon, Jan 26, 2026 at 05:41:38PM +0100, Michal Hocko a écrit :
> > > On Sun 25-01-26 23:45:10, Frederic Weisbecker wrote:
> > > > The HK_TYPE_DOMAIN housekeeping cpumask will soon be made modifiable at
> > > > runtime. In order to synchronize against memcg workqueue to make sure
> > > > that no asynchronous draining is pending or executing on a newly made
> > > > isolated CPU, target and queue a drain work under the same RCU critical
> > > > section.
> > > > 
> > > > Whenever housekeeping will update the HK_TYPE_DOMAIN cpumask, a memcg
> > > > workqueue flush will also be issued in a further change to make sure
> > > > that no work remains pending after a CPU has been made isolated.
> > > > 
> > > > Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
> > > > ---
> > > >  mm/memcontrol.c | 21 +++++++++++++++++----
> > > >  1 file changed, 17 insertions(+), 4 deletions(-)
> > > > 
> > > > diff --git a/mm/memcontrol.c b/mm/memcontrol.c
> > > > index be810c1fbfc3..2289a0299331 100644
> > > > --- a/mm/memcontrol.c
> > > > +++ b/mm/memcontrol.c
> > > > @@ -2003,6 +2003,19 @@ static bool is_memcg_drain_needed(struct memcg_stock_pcp *stock,
> > > >  	return flush;
> > > >  }
> > > >  
> > > > +static void schedule_drain_work(int cpu, struct work_struct *work)
> > > > +{
> > > > +	/*
> > > > +	 * Protect housekeeping cpumask read and work enqueue together
> > > > +	 * in the same RCU critical section so that later cpuset isolated
> > > > +	 * partition update only need to wait for an RCU GP and flush the
> > > > +	 * pending work on newly isolated CPUs.
> > > > +	 */
> > > > +	guard(rcu)();
> > > > +	if (!cpu_is_isolated(cpu))
> > > > +		schedule_work_on(cpu, work);
> > > 
> > > Shouldn't this in the guarded rcu section?
> > 
> > This is what guard(rcu)() does, right?
> > Or am I missing something?
> 
> I am probably misreading the patch. But I've had the following in mind
> 
> 	scoped_guard(rcu) {
> 		if (!cpu_is_isolated(cpu))
> 			schedule_work_on(cpu, work);
> 	}

guard(...)() protects everything that follows within the same block
(here the whole function) whereas scoped_guard only applies to the
following scope (here what is inside the {} in your example).

So both work.

Thanks.

-- 
Frederic Weisbecker
SUSE Labs

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ