[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aWVo9em4C3f1TfOQ@pavilion.home>
Date: Mon, 12 Jan 2026 22:34:45 +0100
From: Frederic Weisbecker <frederic@...nel.org>
To: Waiman Long <llong@...hat.com>
Cc: Simon Horman <horms@...nel.org>, 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>,
Michal Hocko <mhocko@...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>, Tejun Heo <tj@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Vlastimil Babka <vbabka@...e.cz>, 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 13/33] sched/isolation: Convert housekeeping cpumasks to
rcu pointers
Le Sun, Jan 11, 2026 at 09:45:36PM -0500, Waiman Long a écrit :
> On 1/7/26 6:56 AM, Simon Horman wrote:
> > On Thu, Jan 01, 2026 at 11:13:38PM +0100, Frederic Weisbecker wrote:
> > > HK_TYPE_DOMAIN's cpumask will soon be made modifiable by cpuset.
> > > A synchronization mechanism is then needed to synchronize the updates
> > > with the housekeeping cpumask readers.
> > >
> > > Turn the housekeeping cpumasks into RCU pointers. Once a housekeeping
> > > cpumask will be modified, the update side will wait for an RCU grace
> > > period and propagate the change to interested subsystem when deemed
> > > necessary.
> > >
> > > Signed-off-by: Frederic Weisbecker <frederic@...nel.org>
> > > ---
> > > kernel/sched/isolation.c | 58 +++++++++++++++++++++++++---------------
> > > kernel/sched/sched.h | 1 +
> > > 2 files changed, 37 insertions(+), 22 deletions(-)
> > >
> > > diff --git a/kernel/sched/isolation.c b/kernel/sched/isolation.c
> > > index 11a623fa6320..83be49ec2b06 100644
> > > --- a/kernel/sched/isolation.c
> > > +++ b/kernel/sched/isolation.c
> > > @@ -21,7 +21,7 @@ DEFINE_STATIC_KEY_FALSE(housekeeping_overridden);
> > > EXPORT_SYMBOL_GPL(housekeeping_overridden);
> > > struct housekeeping {
> > > - cpumask_var_t cpumasks[HK_TYPE_MAX];
> > > + struct cpumask __rcu *cpumasks[HK_TYPE_MAX];
> > > unsigned long flags;
> > > };
> > > @@ -33,17 +33,28 @@ bool housekeeping_enabled(enum hk_type type)
> > > }
> > > EXPORT_SYMBOL_GPL(housekeeping_enabled);
> > > +const struct cpumask *housekeeping_cpumask(enum hk_type type)
> > > +{
> > > + if (static_branch_unlikely(&housekeeping_overridden)) {
> > > + if (housekeeping.flags & BIT(type)) {
> > > + return rcu_dereference_check(housekeeping.cpumasks[type], 1);
> > > + }
> > > + }
> > > + return cpu_possible_mask;
> > > +}
> > > +EXPORT_SYMBOL_GPL(housekeeping_cpumask);
> > > +
> > Hi Frederic,
> >
> > I think this patch should also update the access to housekeeping.cpumasks
> > in housekeeping_setup(), on line 200, to use housekeeping_cpumask().
> >
> > As is, sparse flags __rcu a annotation miss match there.
> >
> > kernel/sched/isolation.c:200:80: warning: incorrect type in argument 3 (different address spaces)
> > kernel/sched/isolation.c:200:80: expected struct cpumask const *srcp3
> > kernel/sched/isolation.c:200:80: got struct cpumask [noderef] __rcu *
> >
> > ...
> >
> The direct housekeeping.cpumasks[type] reference is in the newly merged
> check after Federic's initial patch series.
>
> iter_flags = housekeeping.flags & (HK_FLAG_KERNEL_NOISE |
> HK_FLAG_DOMAIN);
> type = find_first_bit(&iter_flags, HK_TYPE_MAX);
> /*
> * Pass the check if none of these flags were previously set
> or
> * are not in the current selection.
> */
> iter_flags = flags & (HK_FLAG_KERNEL_NOISE |
> HK_FLAG_DOMAIN);
> first_cpu = (type == HK_TYPE_MAX || !iter_flags) ? 0 :
> cpumask_first_and_and(cpu_present_mask,
> housekeeping_staging,
> housekeeping.cpumasks[type]);
>
> Maybe that is why it is missed.
Good catch guys! Fixing this.
Thanks.
--
Frederic Weisbecker
SUSE Labs
Powered by blists - more mailing lists