Re: [PATCH 13/33] cpuset: Update HK_TYPE_DOMAIN cpumask from cpuset

Frederic Weisbecker
2025-11-05T15:57:55Z

Le Fri, Oct 31, 2025 at 08:59:51AM -0400, Phil Auld a écrit :
> > +int housekeeping_update(struct cpumask *mask, enum hk_type type)
> > +{
> > + struct cpumask *trial, *old = NULL;
> > +
> > + if (type != HK_TYPE_DOMAIN)
> > + return -ENOTSUPP;
> > +
> > + trial = kmalloc(sizeof(*trial), GFP_KERNEL);
> > + if (!trial)
> > + return -ENOMEM;
> > +
> > + cpumask_andnot(trial, housekeeping_cpumask(HK_TYPE_DOMAIN_BOOT), mask);
> > + if (!cpumask_intersects(trial, cpu_online_mask)) {
> > + kfree(trial);
> > + return -EINVAL;
> > + }
> > +
> > + if (!housekeeping.flags)
> > + static_branch_enable(&housekeeping_overridden);
> > +
> > + if (!(housekeeping.flags & BIT(type)))
> > + old = housekeeping_cpumask_dereference(type);
> > + else
> > + WRITE_ONCE(housekeeping.flags, housekeeping.flags | BIT(type));
>
> Isn't this backwards? If the bit is not set you save old to free it
> and if the bit is set you set it again.

That's completely backward!

Thanks for pointing out!

--
Frederic Weisbecker
SUSE Labs