alloc_tag-populate-memory-for-module-tags-as-needed.patch removed from -mm tree
The quilt patch titled
Subject: alloc_tag: populate memory for module tags as needed
has been removed from the -mm tree. Its filename was
alloc_tag-populate-memory-for-module-tags-as-needed.patch
This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm
------------------------------------------------------
From: Suren Baghdasaryan <[email protected]>
Subject: alloc_tag: populate memory for module tags as needed
Date: Wed, 23 Oct 2024 10:07:57 -0700
The memory reserved for module tags does not need to be backed by physical pages until there are tags to store there. Change the way we reserve this memory to allocate only virtual area for the tags and populate it with physical pages as needed when we load a module.
---
include/linux/execmem.h | 12 ++++++ include/linux/vmalloc.h | 3 + lib/Kconfig.debug | 1 lib/alloc_tag.c | 73 +++++++++++++++++++++++++++++++++----- mm/execmem.c | 16 ++++++++ mm/internal.h | 6 +++ mm/vmalloc.c | 4 +- 7 files changed, 104 insertions(+), 11 deletions(-)
include/linux/execmem.h renamed from include/linux/execmem.h~alloc_tag-populate-memory-for-module-tags-as-needed +12 -0
@@ -139,6 +139,18 @@ void *execmem_alloc(enum execmem_type ty*/ void execmem_free (void *ptr); +#ifdef CONFIG_MMU +/** +* execmem_vmap - create virtual mapping for EXECMEM_MODULE_DATA memory +* @size: size of the virtual mapping in bytes +* +* Maps virtually contiguous area in the range suitable for EXECMEM_MODULE_DATA. +* +* Return: the area descriptor on success or %NULL on failure. +*/ +struct vm_struct *execmem_vmap (size_t size); +#endif +/** * execmem_update_copy - copy an update to executable memory * @dst: destination address to update
include/linux/vmalloc.h renamed from include/linux/vmalloc.h~alloc_tag-populate-memory-for-module-tags-as-needed +3 -0
@@ -202,6 +202,9 @@ extern int remap_vmalloc_range_partial(sextern int remap_vmalloc_range (struct vm_area_struct *vma,void *addr,unsigned long pgoff); +int vmap_pages_range (unsigned long addr,unsigned long end,pgprot_t prot, +struct page **pages,unsigned int page_shift); +/* * Architectures can set this mask to a combination of PGTBL_P?D_MODIFIED values * and let generic vmalloc and ioremap code know when arch_sync_kernel_mappings()
lib/alloc_tag.c renamed from lib/alloc_tag.c~alloc_tag-populate-memory-for-module-tags-as-needed +64 -9
125 lines not on this page · raw message
lib/Kconfig.debug renamed from lib/Kconfig.debug~alloc_tag-populate-memory-for-module-tags-as-needed +1 -0
@@ -993,6 +993,7 @@ config CODE_TAGGING config MEM_ALLOC_PROFILING bool "Enable memory allocation profiling" default n + depends on MMU depends on PROC_FS depends on !DEBUG_FORCE_WEAK_PER_CPU select CODE_TAGGING
mm/execmem.c renamed from mm/execmem.c~alloc_tag-populate-memory-for-module-tags-as-needed +16 -0
@@ -64,6 +64,22 @@ static void *execmem_vmalloc(struct exec return p; } + +struct vm_struct *execmem_vmap (size_t size) +{ +struct execmem_range *range = &execmem_info->ranges[EXECMEM_MODULE_DATA ]; +struct vm_struct *area; + + area =__get_vm_area_node (size, range->alignment,PAGE_SHIFT ,VM_ALLOC , + range->start, range->end,NUMA_NO_NODE , +GFP_KERNEL ,__builtin_return_address (0 )); +if (!area && range->fallback_start) + area =__get_vm_area_node (size, range->alignment,PAGE_SHIFT ,VM_ALLOC , + range->fallback_start, range->fallback_end, +NUMA_NO_NODE ,GFP_KERNEL ,__builtin_return_address (0 )); + +return area; +}#else static void *execmem_vmalloc (struct execmem_range *range,size_t size,pgprot_t pgprot,unsigned long vm_flags)
mm/internal.h renamed from mm/internal.h~alloc_tag-populate-memory-for-module-tags-as-needed +6 -0
@@ -1263,6 +1263,12 @@ int numa_migrate_check(struct folio *folvoid free_zone_device_folio (struct folio *folio);int migrate_device_coherent_folio (struct folio *folio); +struct vm_struct *__get_vm_area_node (unsigned long size, +unsigned long align,unsigned long shift, +unsigned long flags,unsigned long start, +unsigned long end,int node,gfp_t gfp_mask, +const void *caller); +/* * mm/gup.c */
mm/vmalloc.c renamed from mm/vmalloc.c~alloc_tag-populate-memory-for-module-tags-as-needed +2 -2
@@ -653,7 +653,7 @@ int vmap_pages_range_noflush(unsigned lo* RETURNS: * 0 on success, -errno on failure. */ -static int vmap_pages_range (unsigned long addr,unsigned long end, +int vmap_pages_range (unsigned long addr,unsigned long end,pgprot_t prot,struct page **pages,unsigned int page_shift) {int err;
@@ -3106,7 +3106,7 @@ static void clear_vm_uninitialized_flag( vm->flags &= ~VM_UNINITIALIZED ; } -static struct vm_struct *__get_vm_area_node (unsigned long size, +struct vm_struct *__get_vm_area_node (unsigned long size,unsigned long align,unsigned long shift,unsigned long flags,unsigned long start,unsigned long end,int node,gfp_t gfp_mask,const void *caller)
_
Patches currently in -mm which might be from [email protected] are
mm-convert-mm_lock_seq-to-a-proper-seqcount.patch
mm-introduce-mmap_lock_speculation_beginend.patch