mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Vlastimil Babka (SUSE)" <vbabka@kernel.org>
To: hu.shengming@zte.com.cn
Cc: surenb@google.com, harry@kernel.org, akpm@linux-foundation.org,
	hao.li@linux.dev, cl@gentwo.org, rientjes@google.com,
	roman.gushchin@linux.dev, linux-mm@kvack.org,
	linux-kernel@vger.kernel.org, zhang.run@zte.com.cn,
	cai.qu@zte.com.cn
Subject: Re: [PATCH v4] mm/slub: use empty sheaf helpers for oversized sheaves
Date: Thu, 28 May 2026 09:26:11 +0200	[thread overview]
Message-ID: <8d65937a-f2c1-498e-9272-d80ae6649285@kernel.org> (raw)
In-Reply-To: <20260528143733563XhbDWw9ZGOiFU9KHd72Xu@zte.com.cn>

On 5/28/26 08:37, hu.shengming@zte.com.cn wrote:
> VlastimilBabka(SUSE)<vbabka@kernel.org> wrote:
>>On 5/27/26 15:48, hu.shengming@zte.com.cn wrote:
>>
>> I see, thanks. Could we perhaps move the mark_obj_codetag_empty() code to
>> alloc_empty_sheaf()? If not, then do as you suggest?
>>
> 
> I looked at moving mark_obj_codetag_empty() to alloc_empty_sheaf(), but I
> don't think it is equivalent to doing it on the free path.
> 
> mark_obj_codetag_empty() only marks an entry if the slab already has
> slabobj_exts. For sheaf metadata allocated with __GFP_NO_OBJ_EXT, the
> allocation hook will not create the object extension. So if the slab has
> no obj_exts at allocation time, an allocation-time mark would be a no-op.
> A slabobj_ext can still be created later for the same kmalloc slab by
> another allocation, and then freeing the sheaf without marking it on the
> free path can still leave the sheaf entry with a NULL tag.

Ah right, makes sense.

> So I think the marking should stay in free_empty_sheaf(). I can still
> move the caller-GFP filtering out of __alloc_empty_sheaf(). That includes
> both clearing OBJCGS_CLEAR_MASK and handling the early rejection of
> caller-supplied __GFP_NO_OBJ_EXT:
> 
> 	if (gfp & __GFP_NO_OBJ_EXT)
> 		return NULL;
> 
> Moving this filtering to the caller would let the oversized prefill path
> avoid losing __GFP_NOFAIL.But I would keep the SLAB_KMALLOC-specific
> __GFP_NO_OBJ_EXT allocation and the matching free-time mark together.

Sounds good! Thanks!

> Please let me know if you have a better suggestion.
> 
> --
> With Best Regards,
> Shengming


      reply	other threads:[~2026-05-28  7:26 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26 15:24 hu.shengming
2026-05-27  8:06 ` Vlastimil Babka (SUSE)
2026-05-27 13:48   ` hu.shengming
2026-05-27 15:47     ` Vlastimil Babka (SUSE)
2026-05-28  6:37       ` hu.shengming
2026-05-28  7:26         ` Vlastimil Babka (SUSE) [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=8d65937a-f2c1-498e-9272-d80ae6649285@kernel.org \
    --to=vbabka@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cai.qu@zte.com.cn \
    --cc=cl@gentwo.org \
    --cc=hao.li@linux.dev \
    --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=surenb@google.com \
    --cc=zhang.run@zte.com.cn \
    /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®