Linux-mm Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Hao Li <hao.li@linux.dev>
To: vbabka@kernel.org, harry@kernel.org, akpm@linux-foundation.org
Cc: cl@gentwo.org, rientjes@google.com, roman.gushchin@linux.dev,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Hao Li <hao.li@linux.dev>
Subject: [PATCH] slub: avoid duplicate trace_kmalloc() in __do_kmalloc_node()
Date: Fri,  4 Dec 2026 04:18:16 +0000	[thread overview]
Message-ID: <20261204042323.94164-1-hao.li@linux.dev> (raw)

The call path __do_kmalloc_node() -> __kmalloc_large_node_noprof()
results in duplicate trace_kmalloc() calls.

Since __kmalloc_large_node_noprof() is a thin wrapper around
___kmalloc_large_node(), call ___kmalloc_large_node() directly instead.
This skips the trace_kmalloc() in __kmalloc_large_node_noprof() and
eliminates the duplication.

Fixes: a0a44d9175b3 ("mm, slab: don't wrap internal functions with alloc_hooks()")
Signed-off-by: Hao Li <hao.li@linux.dev>
---
 mm/slub.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/slub.c b/mm/slub.c
index 5c33d1247060..5399f636be9f 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -5516,7 +5516,7 @@ void *__do_kmalloc_node(kmem_buckets *b, gfp_t flags, int node,
 	void *ret;
 
 	if (unlikely(size > KMALLOC_MAX_CACHE_SIZE)) {
-		ret = __kmalloc_large_node_noprof(size, flags, node);
+		ret = ___kmalloc_large_node(size, flags, node);
 		trace_kmalloc(ac->caller_addr, ret, size,
 			      PAGE_SIZE << get_order(size), flags, node);
 		return ret;
-- 
2.56.1



                 reply	other threads:[~2026-12-04  4:23 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20261204042323.94164-1-hao.li@linux.dev \
    --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=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