mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hao Li <hao.li@linux.dev>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: harry@kernel.org, akpm@linux-foundation.org, cl@gentwo.org,
	 rientjes@google.com, roman.gushchin@linux.dev,
	linux-mm@kvack.org,  linux-kernel@vger.kernel.org,
	Pedro Falcato <pfalcato@suse.de>
Subject: Re: [RFC PATCH 0/2] mm/slub: reduce list_lock contention with slab parking
Date: Wed, 16 Sep 2026 20:58:32 +0800	[thread overview]
Message-ID: <aqqOk9ULIuV-5mQg@fedora> (raw)
In-Reply-To: <4d9ebf64-e3b4-4b6c-9576-e8be59193f80@kernel.org>

On Tue, Sep 15, 2026 at 09:10:22AM +0200, Vlastimil Babka (SUSE) wrote:
> On 9/11/26 13:24, Hao Li wrote:
> > On Mon, Sep 07, 2026 at 03:44:08PM +0200, Vlastimil Babka (SUSE) wrote:
> >> On 8/24/26 14:19, Hao Li wrote:
> >> > 
> >> > Detailed data
> >> > -------------
> >> > 
> >> > metric                              before             after             delta      change
> >> > ==========================================================================================
> >> > alloc_fastpath                     155,417           168,534            13,117      +8.44%
> >> > alloc_slab                      55,679,646        26,702,510       -28,977,136     -52.04%
> >> 
> >> It's interesting that this is reduced so much. Is it because parked slabs
> >> cause more slabs to stay around for reuse, despite they are unparked
> >> immediately when trying to allocate/refill? That seems odd?
> > 
> > Yeah, it does look counter-intuitive at first glance. My understanding is that
> > the parking mechanism helps by bypassing the partial list spinlock, allowing
> > partial slabs to be parked onto the llist locklessly at any point. Because of
> > this, the refill path gets to see and reuse more partial slabs instead of
> > having to allocate fresh ones so frequently.
> 
> Hmm that's an interesting effect, surprisingly large if true. Because the
> slabs we'd be parking are transitioning from full, there would be most often
> just a single free object to reuse?

That makes sense. That said, it might be more than a single object, since
build_detached_freelist() tries to free objects from the same slab together.

Even though we "park" the parking series for now, I was still curious to
understand the underlying behavior. So I add a counter in
get_partial_node_bulk() to see how many partial slabs it can see.
(counting freed objects directly is tough, so the partial slab count gives us a
rough picture)

Interestingly, each get_partial_node_bulk() on the patched kernel saw about
3-4x more partial slabs on average compared to baseline. This suggest that the
parking mechanism can supply more allocatable objects even under lock
contention, since it can avoid waiting for list lock.

For example, in the baseline kernel, if the lock is held by an allocator, a
freer has to wait on it. Once it's released, the lock might just get grabbed by
yet another allocator, leaving the freer stuck waiting. As a result, the
partial list ends up starved of free objects.


-- 
Thanks,
Hao

      reply	other threads:[~2026-09-16 12:58 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-24 12:19 Hao Li
2026-08-24 12:25 ` [RFC PATCH 1/2] mm/slub: make the case handling in __slab_free() easier to follow Hao Li
2026-08-24 12:25   ` [RFC PATCH 2/2] mm/slub: introduce slab parking to reduce list_lock contention Hao Li
2026-09-07 13:38     ` Vlastimil Babka (SUSE)
2026-09-07 16:19       ` Pedro Falcato
2026-09-11 13:06       ` Hao Li
2026-09-15  7:43         ` Vlastimil Babka (SUSE)
2026-09-16  3:05           ` Hao Li
2026-09-16  8:01         ` Vlastimil Babka (SUSE)
2026-09-16 13:50         ` Harry Yoo
2026-09-04 16:04   ` [RFC PATCH 1/2] mm/slub: make the case handling in __slab_free() easier to follow Vlastimil Babka (SUSE)
2026-09-07  2:55     ` Hao Li
2026-09-14 13:39   ` Harry Yoo
2026-09-16 14:00     ` Hao Li
2026-08-27 16:24 ` [RFC PATCH 0/2] mm/slub: reduce list_lock contention with slab parking Pedro Falcato
2026-08-30 14:59   ` Hao Li
2026-09-07 13:44 ` Vlastimil Babka (SUSE)
2026-09-11 11:24   ` Hao Li
2026-09-15  7:10     ` Vlastimil Babka (SUSE)
2026-09-16 12:58       ` Hao Li [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=aqqOk9ULIuV-5mQg@fedora \
    --to=hao.li@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=harry@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=pfalcato@suse.de \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®