Re: [PATCH for-next-fixes v2 4/5] mm/slab: fix a deadlock in memcg_alloc_abort_single()
From: Harry Yoo
Date: Tue Nov 10 2026 - 08:59:34 EST
On Wed, Nov 04, 2026 at 04:46:26PM +0000, Alexei Starovoitov wrote:
> On Wed, Nov 04, 2026 at 07:35 AM Vlastimil Babka (SUSE) <vbabka@xxxxxxxxxx> wrote:
> >> I don't insist on kfree_nolock() there,
> >> but can we try free_to_pcs() before defer_free() ?
> >> Like:
> >>
> >> if (likely(allow_spin))
> >> __slab_free(s, slab, object, object, 1, _RET_IP_);
> >> else if (!can_free_to_pcs(slab) || !free_to_pcs(s, object, false))
> >> defer_free(s, object);
> >
> > Why not try free_to_pcs with allow_spin as well then, and improve
> > memcg_alloc_abort_single() for both contexts?
>
> yep. Even better.
> The bulk side does that already.
> Like:
>
> if (likely(can_free_to_pcs(slab)) &&
> likely(free_to_pcs(s, object, allow_spin)))
> return;
>
> if (likely(allow_spin))
> __slab_free(s, slab, object, object, 1, _RET_IP_);
> else
> defer_free(s, object);
> ?
Will adjust in v3 (hopefully by end of this week!)
Thanks.
--
Cheers,
Harry / Hyeonggon