Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hao Li <hao.li@linux.dev>
To: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
Cc: Harry Yoo <harry@kernel.org>, Christoph Lameter <cl@gentwo.org>,
	 David Rientjes <rientjes@google.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	 Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	 hu.shengming@zte.com.cn,
	Vinicius Costa Gomes <vinicius.gomes@intel.com>
Subject: Re: [PATCH v3 2/2] mm, slab: simplify returning slab in __refill_objects_node()
Date: Mon, 25 May 2026 14:47:34 +0800	[thread overview]
Message-ID: <ahPucZOXNmJc04nZ@fedora> (raw)
In-Reply-To: <20260522-b4-refill-optimistic-return-v3-2-2ba78ec1c6ed@kernel.org>

On Fri, May 22, 2026 at 04:23:21PM +0200, Vlastimil Babka (SUSE) wrote:
> When we return slabs to the partial list because we didn't fully refill
> from them, we observe the min_partial limit when the returned slab is
> empty, and discard it when over the limit. But it's unlikely for the
> limit to be reached while we were refilling, and the worst outcome is to
> have temporarily more free slabs on the list than necessary.

Just wondering if the empty slabs temporarily exceed the limit and then some
objects get allocated from them, would this lead to more fragmented slabs in
the node partial list?

> So just
> drop that code and simplify the function.
> 
> Signed-off-by: Vlastimil Babka (SUSE) <vbabka@kernel.org>
> ---
>  mm/slub.c | 10 ----------
>  1 file changed, 10 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 5816fcfc7a90..074d57c0390b 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -7196,21 +7196,11 @@ __refill_objects_node(struct kmem_cache *s, void **p, gfp_t gfp, unsigned int mi
>  
>  		list_for_each_entry_safe(slab, slab2, &pc.slabs, slab_list) {
>  
> -			if (unlikely(!slab->inuse && n->nr_partial >= s->min_partial))
> -				continue;
> -
>  			list_del(&slab->slab_list);
>  			add_partial(n, slab, ADD_TO_TAIL);
>  		}
>  
>  		spin_unlock_irqrestore(&n->list_lock, flags);
> -
> -		/* any slabs left are completely free and for discard */
> -		list_for_each_entry_safe(slab, slab2, &pc.slabs, slab_list) {
> -
> -			list_del(&slab->slab_list);
> -			discard_slab(s, slab);
> -		}
>  	}
>  
>  	return refilled;
> 
> -- 
> 2.54.0
> 

-- 
Thanks,
Hao


  reply	other threads:[~2026-05-25  6:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-22 14:23 [PATCH v3 0/2] mm, slab: optimize returning objects after a partial refill Vlastimil Babka (SUSE)
2026-05-22 14:23 ` [PATCH v3 1/2] mm, slab: add an optimistic __slab_try_return_freelist() Vlastimil Babka (SUSE)
2026-05-22 17:40   ` Vlastimil Babka (SUSE)
2026-05-22 14:23 ` [PATCH v3 2/2] mm, slab: simplify returning slab in __refill_objects_node() Vlastimil Babka (SUSE)
2026-05-25  6:47   ` Hao Li [this message]
2026-05-25  7:15     ` Vlastimil Babka (SUSE)
2026-05-25 11:51       ` Hao Li

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=ahPucZOXNmJc04nZ@fedora \
    --to=hao.li@linux.dev \
    --cc=akpm@linux-foundation.org \
    --cc=cl@gentwo.org \
    --cc=harry@kernel.org \
    --cc=hu.shengming@zte.com.cn \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=vbabka@kernel.org \
    --cc=vinicius.gomes@intel.com \
    /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