[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20220308114142.1744229-7-42.hyeyoo@gmail.com>
Date: Tue, 8 Mar 2022 11:41:33 +0000
From: Hyeonggon Yoo <42.hyeyoo@...il.com>
To: linux-mm@...ck.org
Cc: Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Vlastimil Babka <vbabka@...e.cz>,
Marco Elver <elver@...gle.com>,
Matthew WilCox <willy@...radead.org>,
Roman Gushchin <roman.gushchin@...ux.dev>,
linux-kernel@...r.kernel.org, 42.hyeyoo@...il.com
Subject: [RFC PATCH v1 06/15] mm/slab_common: cleanup kmalloc_large()
Now that kmalloc_large() and kmalloc_large_node() do same job,
make kmalloc_large() wrapper of kmalloc_large_node().
This makes slab allocators to use kmalloc_node tracepoint in
kmalloc_large().
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@...il.com>
---
include/linux/slab.h | 8 +++++---
mm/slab_common.c | 24 ------------------------
2 files changed, 5 insertions(+), 27 deletions(-)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 60d27635c13d..8840b2d55567 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -467,12 +467,14 @@ extern void *kmem_cache_alloc_node_trace(struct kmem_cache *s, gfp_t gfpflags,
int node, size_t size) __assume_slab_alignment
__alloc_size(4);
-extern void *kmalloc_large(size_t size, gfp_t flags) __assume_page_alignment
- __alloc_size(1);
-
extern void *kmalloc_large_node(size_t size, gfp_t flags, int node)
__assume_page_alignment __alloc_size(1);
+static __always_inline void *kmalloc_large(size_t size, gfp_t flags)
+{
+ return kmalloc_large_node(size, flags, NUMA_NO_NODE);
+}
+
/**
* kmalloc - allocate memory
* @size: how many bytes of memory are required.
diff --git a/mm/slab_common.c b/mm/slab_common.c
index f61ac7458829..1fe2f2a7326d 100644
--- a/mm/slab_common.c
+++ b/mm/slab_common.c
@@ -932,30 +932,6 @@ gfp_t kmalloc_fix_flags(gfp_t flags)
* directly to the page allocator. We use __GFP_COMP, because we will need to
* know the allocation order to free the pages properly in kfree.
*/
-void *kmalloc_large(size_t size, gfp_t flags)
-{
- void *ret = NULL;
- struct page *page;
- unsigned int order = get_order(size);
-
- if (unlikely(flags & GFP_SLAB_BUG_MASK))
- flags = kmalloc_fix_flags(flags);
-
- flags |= __GFP_COMP;
- page = alloc_pages(flags, order);
- if (likely(page)) {
- ret = page_address(page);
- mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B,
- PAGE_SIZE << order);
- }
- ret = kasan_kmalloc_large(ret, size, flags);
- /* As ret might get tagged, call kmemleak hook after KASAN. */
- kmemleak_alloc(ret, size, 1, flags);
- trace_kmalloc(_RET_IP_, ret, size, PAGE_SIZE << order, flags);
- return ret;
-}
-EXPORT_SYMBOL(kmalloc_large);
-
void *kmalloc_large_node(size_t size, gfp_t flags, int node)
{
struct page *page;
--
2.33.1
Powered by blists - more mailing lists