]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
mm/vma: add page table limit to unmap_region()
authorLiam R. Howlett <Liam.Howlett@oracle.com>
Wed, 21 Jan 2026 16:49:41 +0000 (11:49 -0500)
committerAndrew Morton <akpm@linux-foundation.org>
Thu, 12 Feb 2026 23:42:54 +0000 (15:42 -0800)
The unmap_region() calls need to pass through the page table limit for a
future patch.

No functional changes intended.

Link: https://lkml.kernel.org/r/20260121164946.2093480-7-Liam.Howlett@oracle.com
Signed-off-by: Liam R. Howlett <Liam.Howlett@oracle.com>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Reviewed-by: Pedro Falcato <pfalcato@suse.de>
Cc: Baoquan He <bhe@redhat.com>
Cc: Barry Song <baohua@kernel.org>
Cc: Chris Li <chrisl@kernel.org>
Cc: David Hildenbrand <david@kernel.org>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jann Horn <jannh@google.com>
Cc: Kairui Song <kasong@tencent.com>
Cc: Kemeng Shi <shikemeng@huaweicloud.com>
Cc: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: Mike Rapoport <rppt@kernel.org>
Cc: Nhat Pham <nphamcs@gmail.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Suren Baghdasaryan <surenb@google.com>
Cc: Vlastimil Babka <vbabka@suse.cz>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/vma.c
mm/vma.h

index b2b9e7b3284f3c7769672e407914fd7bad4cdbc8..b92383e5eebd1e0bcb1c8876386c43be80e9ea7f 100644 (file)
--- a/mm/vma.c
+++ b/mm/vma.c
@@ -474,7 +474,8 @@ void remove_vma(struct vm_area_struct *vma)
  */
 void unmap_region(struct ma_state *mas, struct vm_area_struct *vma,
                unsigned long vma_start, unsigned long vma_end,
-               struct vm_area_struct *prev, struct vm_area_struct *next)
+               unsigned long pg_max, struct vm_area_struct *prev,
+               struct vm_area_struct *next)
 {
        struct mm_struct *mm = vma->vm_mm;
        struct mmu_gather tlb;
@@ -484,8 +485,7 @@ void unmap_region(struct ma_state *mas, struct vm_area_struct *vma,
        unmap_vmas(&tlb, mas, vma, vma_start, vma_end, vma_end);
        mas_set(mas, vma->vm_end);
        free_pgtables(&tlb, mas, vma, prev ? prev->vm_end : FIRST_USER_ADDRESS,
-                     next ? next->vm_start : USER_PGTABLES_CEILING,
-                     next ? next->vm_start : USER_PGTABLES_CEILING,
+                     pg_max, next ? next->vm_start : USER_PGTABLES_CEILING,
                      /* mm_wr_locked = */ true);
        tlb_finish_mmu(&tlb);
 }
@@ -2469,6 +2469,7 @@ static int __mmap_new_file_vma(struct mmap_state *map,
                vma_iter_set(vmi, vma->vm_end);
                /* Undo any partial mapping done by a device driver. */
                unmap_region(&vmi->mas, vma, vma->vm_start, vma->vm_end,
+                            map->next ? map->next->vm_start : USER_PGTABLES_CEILING,
                             map->prev, map->next);
 
                return error;
index e671adced3a031717b11119e09bfefe1187f0645..7c2c95fef240b027d5cc2f20116353273e30df4c 100644 (file)
--- a/mm/vma.h
+++ b/mm/vma.h
@@ -265,7 +265,8 @@ void remove_vma(struct vm_area_struct *vma);
 
 void unmap_region(struct ma_state *mas, struct vm_area_struct *vma,
                unsigned long vma_start, unsigned long vma_end,
-               struct vm_area_struct *prev, struct vm_area_struct *next);
+               unsigned long pg_max, struct vm_area_struct *prev,
+               struct vm_area_struct *next);
 
 /**
  * vma_modify_flags() - Perform any necessary split/merge in preparation for