arm64: Silence first allocation with CONFIG_ARM64_MODULE_PLTS=y
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 27 Apr 2017 18:19:02 +0000 (11:19 -0700)
committerCatalin Marinas <catalin.marinas@arm.com>
Thu, 11 May 2017 13:43:40 +0000 (14:43 +0100)
When CONFIG_ARM64_MODULE_PLTS is enabled, the first allocation using the
module space fails, because the module is too big, and then the module
allocation is attempted from vmalloc space. Silence the first allocation
failure in that case by setting __GFP_NOWARN.

Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
arch/arm64/kernel/module.c

index c9a2ab446dc6fceb4a141fce131937048432da56..f035ff6fb223fb55b3f8b11c48f58f2ee46ac3cf 100644 (file)
 
 void *module_alloc(unsigned long size)
 {
+       gfp_t gfp_mask = GFP_KERNEL;
        void *p;
 
+       /* Silence the initial allocation */
+       if (IS_ENABLED(CONFIG_ARM64_MODULE_PLTS))
+               gfp_mask |= __GFP_NOWARN;
+
        p = __vmalloc_node_range(size, MODULE_ALIGN, module_alloc_base,
                                module_alloc_base + MODULES_VSIZE,
-                               GFP_KERNEL, PAGE_KERNEL_EXEC, 0,
+                               gfp_mask, PAGE_KERNEL_EXEC, 0,
                                NUMA_NO_NODE, __builtin_return_address(0));
 
        if (!p && IS_ENABLED(CONFIG_ARM64_MODULE_PLTS) &&