Re: [PATCH v2] mm/shrinker: Fix refcount leak in shrink_slab_memcg()
From: Altan Hacigumus
Date: Wed Apr 15 2026 - 21:13:02 EST
On Wed, Apr 15, 2026 at 2:27 PM Suren Baghdasaryan <surenb@xxxxxxxxxx> wrote:
>
> On Tue, Feb 3, 2026 at 8:00 PM Muchun Song <muchun.song@xxxxxxxxx> wrote:
> >
> >
> >
> > > On Feb 4, 2026, at 11:35, Altan Hacigumus <ahacigu.linux@xxxxxxxxx> wrote:
> > >
> > > When kmem is disabled for memcg, slab-backed shrinkers are skipped.
> > > However, shrink_slab_memcg() doesn't drop the reference acquired via
> > > shrinker_try_get() before continuing.
> > >
> > > Add the missing shrinker_put().
> > >
> > > Also, since memcg_kmem_online() and shrinker flags cannot change
> > > dynamically, remove the shrinker from the bitmap to avoid unnecessary
> > > future scans.
> > >
> > > Fixes: 50d09da8e119 ("mm: shrinker: make memcg slab shrink lockless")
>
> Sorry for noticing this late but 50d09da8e119 was introduced back in
> 6.6. Is there a reason this change is not CC'ed to
> stable@xxxxxxxxxxxxxxx ?
>
Right, no particular reason; it should be fine for stable.
Thanks,
Altan