Thread (65 messages) 65 messages, 12 authors, 2023-07-17

Re: [PATCH v2 01/12] nios2: define virtual address space for modules

From: "Edgecombe, Rick P" <rick.p.edgecombe@intel.com>
Date: 2023-06-16 16:00:36
Also in: bpf, linux-arm-kernel, linux-mips, linux-mm, linux-modules, linux-riscv, linux-s390, linuxppc-dev, lkml, loongarch, netdev, sparclinux

On Fri, 2023-06-16 at 11:50 +0300, Mike Rapoport wrote:
 void *module_alloc(unsigned long size)
 {
-       if (size == 0)
-               return NULL;
-       return kmalloc(size, GFP_KERNEL);
-}
-
-/* Free memory returned from module_alloc */
-void module_memfree(void *module_region)
-{
-       kfree(module_region);
+       return __vmalloc_node_range(size, 1, MODULES_VADDR,
MODULES_END,
+                                   GFP_KERNEL, PAGE_KERNEL_EXEC,
+                                   VM_FLUSH_RESET_PERMS,
NUMA_NO_NODE,
+                                   __builtin_return_address(0));
 }
 
 int apply_relocate_add(Elf32_Shdr *sechdrs, const char *s
I wonder if the (size == 0) check is really needed, but
__vmalloc_node_range() will WARN on this case where the old code won't.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help