From: Mike Rapoport <rppt@xxxxxxxxxxxxx> The permissions of pages allocated by module_alloc() are frequently updated using set_memory and set_direct_map APIs. Such permission changes cause fragmentation of the direct map. Since module_alloc() essentially wraps vmalloc(), the memory allocated by it is mapped in the vmalloc area and it can be completely removed from the direct map. Use __GFP_UNMAPPED to utilize caching of unmapped pages done by the page allocator. Signed-off-by: Mike Rapoport <rppt@xxxxxxxxxxxxx> --- arch/x86/kernel/module.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/kernel/module.c b/arch/x86/kernel/module.c index 95fa745e310a..70aa6ec0cc16 100644 --- a/arch/x86/kernel/module.c +++ b/arch/x86/kernel/module.c @@ -75,7 +75,7 @@ void *module_alloc(unsigned long size) p = __vmalloc_node_range(size, MODULE_ALIGN, MODULES_VADDR + get_module_load_offset(), - MODULES_END, gfp_mask, + MODULES_END, gfp_mask | __GFP_UNMAPPED, PAGE_KERNEL, VM_DEFER_KMEMLEAK, NUMA_NO_NODE, __builtin_return_address(0)); if (p && (kasan_module_alloc(p, size, gfp_mask) < 0)) { -- 2.34.1