lkml.org 
[lkml]   [2022]   [Jul]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[patch 19/38] x86/module: Provide __module_alloc()
Date
Provide a function to allocate from module space with large TLBs. This is
required for callthunks as otherwise the ITLB pressure kills performance.

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
---
arch/x86/include/asm/module.h | 2 ++
arch/x86/mm/module_alloc.c | 10 ++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)

--- a/arch/x86/include/asm/module.h
+++ b/arch/x86/include/asm/module.h
@@ -13,4 +13,6 @@ struct mod_arch_specific {
#endif
};

+extern void *__module_alloc(unsigned long size, unsigned long vmflags);
+
#endif /* _ASM_X86_MODULE_H */
--- a/arch/x86/mm/module_alloc.c
+++ b/arch/x86/mm/module_alloc.c
@@ -39,7 +39,7 @@ static unsigned long int get_module_load
}
#endif

-void *module_alloc(unsigned long size)
+void *__module_alloc(unsigned long size, unsigned long vmflags)
{
gfp_t gfp_mask = GFP_KERNEL;
void *p;
@@ -47,10 +47,11 @@ void *module_alloc(unsigned long size)
if (PAGE_ALIGN(size) > MODULES_LEN)
return NULL;

+ vmflags |= VM_FLUSH_RESET_PERMS | VM_DEFER_KMEMLEAK;
p = __vmalloc_node_range(size, MODULE_ALIGN,
MODULES_VADDR + get_module_load_offset(),
MODULES_END, gfp_mask, PAGE_KERNEL,
- VM_FLUSH_RESET_PERMS | VM_DEFER_KMEMLEAK,
+ vmflags,
NUMA_NO_NODE, __builtin_return_address(0));

if (p && (kasan_alloc_module_shadow(p, size, gfp_mask) < 0)) {
@@ -60,3 +61,8 @@ void *module_alloc(unsigned long size)

return p;
}
+
+void *module_alloc(unsigned long size)
+{
+ return __module_alloc(size, 0);
+}
\
 
 \ /
  Last update: 2022-07-17 01:19    [W:1.362 / U:0.004 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site