mm-add-mmap_action_map_kernel_pages.patch removed from -mm tree
The quilt patch titled
Subject: mm: add mmap_action_map_kernel_pages[_full]()
has been removed from the -mm tree. Its filename was
mm-add-mmap_action_map_kernel_pages.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: "Lorenzo Stoakes (Oracle)" <[email protected]>
Subject: mm: add mmap_action_map_kernel_pages[_full]()
Date: Fri, 20 Mar 2026 22:39:46 +0000
A user can invoke mmap_action_map_kernel_pages() to specify that the mapping should map kernel pages starting from desc->start of a specified number of pages specified in an array.
In order to implement this, adjust mmap_action_prepare() to be able to return an error code, as it makes sense to assert that the specified parameters are valid as quickly as possible as well as updating the VMA flags to include VMA_MIXEDMAP_BIT as necessary.
This provides an mmap_prepare equivalent of vm_insert_pages(). We additionally update the existing vm_insert_pages() code to use range_in_vma() and add a new range_in_vma_desc() helper function for the mmap_prepare case, sharing the code between the two in range_is_subset().
We add both mmap_action_map_kernel_pages() and mmap_action_map_kernel_pages_full() to allow for both partial and full VMA mappings.
We update the documentation to reflect the new features.
Finally, we update the VMA tests accordingly to reflect the changes.
---
Documentation/filesystems/mmap_prepare.rst | 8 + include/linux/mm.h | 95 ++++++++++++++++++- include/linux/mm_types.h | 7 + mm/memory.c | 42 +++++++- mm/util.c | 7 + tools/testing/vma/include/dup.h | 7 + 6 files changed, 160 insertions(+), 6 deletions(-)
Documentation/filesystems/mmap_prepare.rst renamed from Documentation/filesystems/mmap_prepare.rst~mm-add-mmap_action_map_kernel_pages +8 -0
@@ -156,5 +156,13 @@ pointer. These are: * mmap_action_simple_ioremap() - Sets up an I/O remap from a specified physical address and over a specified length. +* mmap_action_map_kernel_pages() - Maps a specified array of `struct page` + pointers in the VMA from a specific offset. + +* mmap_action_map_kernel_pages_full() - Maps a specified array of `struct + page` pointers over the entire VMA. The caller must ensure there are + sufficient entries in the page array to cover the entire range of the + described VMA. + **NOTE:** The ``action`` field should never normally be manipulated directly, rather you ought to use one of these helpers.
include/linux/mm.h renamed from include/linux/mm.h~mm-add-mmap_action_map_kernel_pages +93 -2
122 lines not on this page · raw message
include/linux/mm_types.h renamed from include/linux/mm_types.h~mm-add-mmap_action_map_kernel_pages +7 -0
@@ -815,6 +815,7 @@ enum mmap_action_type {MMAP_REMAP_PFN ,/* Remap PFN range. */ MMAP_IO_REMAP_PFN ,/* I/O remap PFN range. */ MMAP_SIMPLE_IO_REMAP ,/* I/O remap with guardrails. */ + MMAP_MAP_KERNEL_PAGES, /* Map kernel page range from array. */ };/*
@@ -833,6 +834,12 @@ struct mmap_action {phys_addr_t start_phys_addr;unsigned long size; } simple_ioremap; +struct { +unsigned long start; +struct page **pages; +unsigned long nr_pages; +pgoff_t pgoff; + } map_kernel; };enum mmap_action_type type;
mm/memory.c renamed from mm/memory.c~mm-add-mmap_action_map_kernel_pages +38 -4
57 lines not on this page · raw message
mm/util.c renamed from mm/util.c~mm-add-mmap_action_map_kernel_pages +7 -0
@@ -1448,6 +1448,8 @@ int mmap_action_prepare(struct vm_area_dreturn io_remap_pfn_range_prepare (desc);case MMAP_SIMPLE_IO_REMAP :return simple_ioremap_prepare (desc); +case MMAP_MAP_KERNEL_PAGES : +return map_kernel_pages_prepare (desc); }WARN_ON_ONCE (1 );
@@ -1475,6 +1477,9 @@ int mmap_action_complete(struct vm_area_case MMAP_REMAP_PFN : err =remap_pfn_range_complete (vma, action);break ; +case MMAP_MAP_KERNEL_PAGES : + err =map_kernel_pages_complete (vma, action); +break ;case MMAP_IO_REMAP_PFN :case MMAP_SIMPLE_IO_REMAP :/* Should have been delegated. */
@@ -1495,6 +1500,7 @@ int mmap_action_prepare(struct vm_area_dcase MMAP_REMAP_PFN :case MMAP_IO_REMAP_PFN :case MMAP_SIMPLE_IO_REMAP : +case MMAP_MAP_KERNEL_PAGES :WARN_ON_ONCE (1 );/* nommu cannot handle these. */ break ; }
@@ -1514,6 +1520,7 @@ int mmap_action_complete(struct vm_area_case MMAP_REMAP_PFN :case MMAP_IO_REMAP_PFN :case MMAP_SIMPLE_IO_REMAP : +case MMAP_MAP_KERNEL_PAGES :WARN_ON_ONCE (1 );/* nommu cannot handle this. */ err = -EINVAL ;
tools/testing/vma/include/dup.h renamed from tools/testing/vma/include/dup.h~mm-add-mmap_action_map_kernel_pages +7 -0
@@ -454,6 +454,7 @@ enum mmap_action_type {MMAP_REMAP_PFN ,/* Remap PFN range. */ MMAP_IO_REMAP_PFN ,/* I/O remap PFN range. */ MMAP_SIMPLE_IO_REMAP ,/* I/O remap with guardrails. */ + MMAP_MAP_KERNEL_PAGES, /* Map kernel page range from an array. */ };/*
@@ -472,6 +473,12 @@ struct mmap_action {phys_addr_t start_phys_addr;unsigned long size; } simple_ioremap; +struct { +unsigned long start; +struct page **pages; +unsigned long nr_pages; +pgoff_t pgoff; + } map_kernel; };enum mmap_action_type type;
_
Patches currently in -mm which might be from [email protected] are
maintainers-update-mglru-entry-to-reflect-current-status.patch selftests-mm-add-merge-test-for-partial-msealed-range.patch