[PATCH v1 2/2] LoongArch: mm: Expand modules virtual address space to 2GB
From: Tiezhu Yang
Date: Fri Jul 17 2026 - 03:57:58 EST
Frequent "execmem: unable to allocate memory" warnings are observed
during kernel module loading when updating the latest kernel.
This is because the modules virtual address region on LoongArch is
tightly constrained to 256MB, while ARM64 and RISC-V are natively
configured with a spacious 2GB region.
Expand the modules virtual address space to 2GB for LoongArch to
eliminate these allocation bottlenecks.
This change only applies to 64-bit kernels (CONFIG_64BIT), 32-bit
kernels (CONFIG_32BIT) are entirely unaffected since they do not
define separate module address regions.
With this patch, there are no "execmem: unable to allocate memory"
warnings anymore for 64-bit kernels.
Signed-off-by: Tiezhu Yang <yangtiezhu@xxxxxxxxxxx>
---
arch/loongarch/include/asm/pgtable.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/loongarch/include/asm/pgtable.h b/arch/loongarch/include/asm/pgtable.h
index 223528c04d73..e5952ecd6a73 100644
--- a/arch/loongarch/include/asm/pgtable.h
+++ b/arch/loongarch/include/asm/pgtable.h
@@ -96,7 +96,7 @@ struct vm_area_struct;
#ifdef CONFIG_64BIT
#define MODULES_VADDR (vm_map_base + PCI_IOSIZE + (2 * PAGE_SIZE))
-#define MODULES_END (MODULES_VADDR + SZ_256M)
+#define MODULES_END (MODULES_VADDR + SZ_2G)
#ifdef CONFIG_KFENCE
#define KFENCE_AREA_SIZE (((CONFIG_KFENCE_NUM_OBJECTS + 1) * 2 + 2) * PAGE_SIZE)
--
2.42.0