linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Harry Yoo <harry.yoo@oracle.com>
To: Andrew Morton <akpm@linux-foundation.org>,
	Vlastimil Babka <vbabka@suse.cz>
Cc: Christoph Lameter <cl@gentwo.org>,
	David Rientjes <rientjes@google.com>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Hao Li <hao.li@linux.dev>, Alexei Starovoitov <ast@kernel.org>,
	Catalin Marinas <catalin.marinas@arm.com>,
	Uladzislau Rezki <urezki@gmail.com>,
	Suren Baghdasaryan <surenb@google.com>,
	linux-mm@kvack.org
Subject: Re: [PATCH 2/2] mm/slab: free a bit in enum objexts_flags
Date: Tue, 10 Feb 2026 10:44:40 +0900	[thread overview]
Message-ID: <aYqNiD47P-Esvdjy@hyeyoo> (raw)
In-Reply-To: <20260209121013.50475-3-harry.yoo@oracle.com>

On Mon, Feb 09, 2026 at 09:10:13PM +0900, Harry Yoo wrote:
> Since kfree() now supports freeing objects allocated with
> kmalloc_nolock(), free one bit in enum object_flags.
> 
> Signed-off-by: Harry Yoo <harry.yoo@oracle.com>

Oops, looks like I forgot to add Alexei's ack, and...

> ---
>  include/linux/memcontrol.h |  3 +--
>  mm/slub.c                  | 12 ++----------
>  2 files changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/mm/slub.c b/mm/slub.c
> index 63b03fd62ca7..33d2cae8f939 100644
> --- a/mm/slub.c
> +++ b/mm/slub.c
> @@ -2213,10 +2211,7 @@ int alloc_slab_obj_exts(struct slab *slab, struct kmem_cache *s,
>  		 * objcg vector should be reused.
>  		 */
>  		mark_objexts_empty(vec);
> -		if (unlikely(!allow_spin))
> -			kfree_nolock(vec);
> -		else
> -			kfree(vec);
> +		kfree(vec);
>  		return 0;

Oh Harry, no.

We still need to check allow_spin in this case.

Just because you can free objects allocated from kmalloc_nolock() with
kfree() doesn't mean you can call kfree() when allow_spin == false.

I'll respin v2.

>  	} else if (cmpxchg(&slab->obj_exts, old_exts, new_exts) != old_exts) {
>  		/* Retry if a racing thread changed slab->obj_exts from under us. */

-- 
Cheers,
Harry / Hyeonggon


      reply	other threads:[~2026-02-10  1:45 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-02-09 12:10 [PATCH 0/2] mm/slab: support kmalloc_nolock() -> kfree[_rcu]() Harry Yoo
2026-02-09 12:10 ` [PATCH 1/2] mm/slab: allow freeing kmalloc_nolock()'d objects using kfree[_rcu]() Harry Yoo
2026-02-09 18:34   ` Catalin Marinas
2026-02-10  1:50     ` Harry Yoo
2026-02-09 12:10 ` [PATCH 2/2] mm/slab: free a bit in enum objexts_flags Harry Yoo
2026-02-10  1:44   ` Harry Yoo [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=aYqNiD47P-Esvdjy@hyeyoo \
    --to=harry.yoo@oracle.com \
    --cc=akpm@linux-foundation.org \
    --cc=ast@kernel.org \
    --cc=catalin.marinas@arm.com \
    --cc=cl@gentwo.org \
    --cc=hao.li@linux.dev \
    --cc=linux-mm@kvack.org \
    --cc=rientjes@google.com \
    --cc=roman.gushchin@linux.dev \
    --cc=surenb@google.com \
    --cc=urezki@gmail.com \
    --cc=vbabka@suse.cz \
    /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