Re: [PATCH] mm/mempolicy: convert mempolicy refcnt to refcount_t

From: Gregory Price

Date: Fri Oct 16 2026 - 09:19:36 EST


On Fri, Oct 16, 2026 at 09:54:33AM +0200, David Hildenbrand (Arm) wrote:
> On 10/16/26 01:13, Gregory Price (Meta) wrote:
> > struct mempolicy uses an atomic_t as a pure reference counter.
> >
> > Convert it to refcount_t so that overflow and underflow are caught
> > by the refcount saturation checks.
> >
> > This silences the atomic_as_refcounter.cocci warning, which started
> > matching __mpol_put() when it switched kmem_cache_free() to kfree_rcu().
> >
> > No functional change for correct callers.
> >
> > Reported-by: kernel test robot <lkp@xxxxxxxxx>
> > Closes: https://lore.kernel.org/oe-kbuild-all/202610061946.Bx22ZFrw-lkp@xxxxxxxxx/
> > Signed-off-by: Gregory Price (Meta) <gourry@xxxxxxxxxx>
> > ---
>
> Wondering if we want a Fixes? If this only fixes cocci warnings I guess not.
>

That was my thought.

> Acked-by: David Hildenbrand (Arm) <david@xxxxxxxxxx>