diff options
author | Hyeonggon Yoo <42.hyeyoo@gmail.com> | 2022-08-17 12:18:16 +0200 |
---|---|---|
committer | Vlastimil Babka <vbabka@suse.cz> | 2022-08-24 16:11:41 +0200 |
commit | a0c3b940023eef3fa005b2bc37d9312712331dcb (patch) | |
tree | 1ad53ee13d27a2f60506a40ab82c57a96039ef6d /mm/slab_common.c | |
parent | mm/slab_common: fold kmalloc_order_trace() into kmalloc_large() (diff) | |
download | linux-a0c3b940023eef3fa005b2bc37d9312712331dcb.tar.xz linux-a0c3b940023eef3fa005b2bc37d9312712331dcb.zip |
mm/slub: move kmalloc_large_node() to slab_common.c
In later patch SLAB will also pass requests larger than order-1 page
to page allocator. Move kmalloc_large_node() to slab_common.c.
Fold kmalloc_large_node_hook() into kmalloc_large_node() as there is
no other caller.
Signed-off-by: Hyeonggon Yoo <42.hyeyoo@gmail.com>
Reviewed-by: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Diffstat (limited to 'mm/slab_common.c')
-rw-r--r-- | mm/slab_common.c | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/mm/slab_common.c b/mm/slab_common.c index 8b1988544b89..1b9101f9cb21 100644 --- a/mm/slab_common.c +++ b/mm/slab_common.c @@ -928,6 +928,28 @@ void *kmalloc_large(size_t size, gfp_t flags) } EXPORT_SYMBOL(kmalloc_large); +void *kmalloc_large_node(size_t size, gfp_t flags, int node) +{ + struct page *page; + void *ptr = NULL; + unsigned int order = get_order(size); + + flags |= __GFP_COMP; + page = alloc_pages_node(node, flags, order); + if (page) { + ptr = page_address(page); + mod_lruvec_page_state(page, NR_SLAB_UNRECLAIMABLE_B, + PAGE_SIZE << order); + } + + ptr = kasan_kmalloc_large(ptr, size, flags); + /* As ptr might get tagged, call kmemleak hook after KASAN. */ + kmemleak_alloc(ptr, size, 1, flags); + + return ptr; +} +EXPORT_SYMBOL(kmalloc_large_node); + #ifdef CONFIG_SLAB_FREELIST_RANDOM /* Randomize a generic freelist */ static void freelist_randomize(struct rnd_state *state, unsigned int *list, |