Commit 7d4a8be0 authored by Alistair Popple's avatar Alistair Popple Committed by Andrew Morton

mm/mmu_notifier: remove unused mmu_notifier_range_update_to_read_only export

mmu_notifier_range_update_to_read_only() was originally introduced in
commit c6d23413 ("mm/mmu_notifier:
mmu_notifier_range_update_to_read_only() helper") as an optimisation for
device drivers that know a range has only been mapped read-only.  However
there are no users of this feature so remove it.  As it is the only user
of the struct mmu_notifier_range.vma field remove that also.

Link: https://lkml.kernel.org/r/20230110025722.600912-1-apopple@nvidia.comSigned-off-by: default avatarAlistair Popple <apopple@nvidia.com>
Acked-by: default avatarMike Rapoport (IBM) <rppt@kernel.org>
Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Reviewed-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
Cc: Ira Weiny <ira.weiny@intel.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: John Hubbard <jhubbard@nvidia.com>
Cc: Ralph Campbell <rcampbell@nvidia.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
parent 9e552271
...@@ -1306,7 +1306,7 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf, ...@@ -1306,7 +1306,7 @@ static ssize_t clear_refs_write(struct file *file, const char __user *buf,
inc_tlb_flush_pending(mm); inc_tlb_flush_pending(mm);
mmu_notifier_range_init(&range, MMU_NOTIFY_SOFT_DIRTY, mmu_notifier_range_init(&range, MMU_NOTIFY_SOFT_DIRTY,
0, NULL, mm, 0, -1UL); 0, mm, 0, -1UL);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
} }
walk_page_range(mm, 0, -1, &clear_refs_walk_ops, &cp); walk_page_range(mm, 0, -1, &clear_refs_walk_ops, &cp);
......
...@@ -269,7 +269,6 @@ extern struct lockdep_map __mmu_notifier_invalidate_range_start_map; ...@@ -269,7 +269,6 @@ extern struct lockdep_map __mmu_notifier_invalidate_range_start_map;
#endif #endif
struct mmu_notifier_range { struct mmu_notifier_range {
struct vm_area_struct *vma;
struct mm_struct *mm; struct mm_struct *mm;
unsigned long start; unsigned long start;
unsigned long end; unsigned long end;
...@@ -514,12 +513,10 @@ static inline void mmu_notifier_subscriptions_destroy(struct mm_struct *mm) ...@@ -514,12 +513,10 @@ static inline void mmu_notifier_subscriptions_destroy(struct mm_struct *mm)
static inline void mmu_notifier_range_init(struct mmu_notifier_range *range, static inline void mmu_notifier_range_init(struct mmu_notifier_range *range,
enum mmu_notifier_event event, enum mmu_notifier_event event,
unsigned flags, unsigned flags,
struct vm_area_struct *vma,
struct mm_struct *mm, struct mm_struct *mm,
unsigned long start, unsigned long start,
unsigned long end) unsigned long end)
{ {
range->vma = vma;
range->event = event; range->event = event;
range->mm = mm; range->mm = mm;
range->start = start; range->start = start;
...@@ -530,10 +527,10 @@ static inline void mmu_notifier_range_init(struct mmu_notifier_range *range, ...@@ -530,10 +527,10 @@ static inline void mmu_notifier_range_init(struct mmu_notifier_range *range,
static inline void mmu_notifier_range_init_owner( static inline void mmu_notifier_range_init_owner(
struct mmu_notifier_range *range, struct mmu_notifier_range *range,
enum mmu_notifier_event event, unsigned int flags, enum mmu_notifier_event event, unsigned int flags,
struct vm_area_struct *vma, struct mm_struct *mm, struct mm_struct *mm, unsigned long start,
unsigned long start, unsigned long end, void *owner) unsigned long end, void *owner)
{ {
mmu_notifier_range_init(range, event, flags, vma, mm, start, end); mmu_notifier_range_init(range, event, flags, mm, start, end);
range->owner = owner; range->owner = owner;
} }
...@@ -659,9 +656,9 @@ static inline void _mmu_notifier_range_init(struct mmu_notifier_range *range, ...@@ -659,9 +656,9 @@ static inline void _mmu_notifier_range_init(struct mmu_notifier_range *range,
range->end = end; range->end = end;
} }
#define mmu_notifier_range_init(range,event,flags,vma,mm,start,end) \ #define mmu_notifier_range_init(range,event,flags,mm,start,end) \
_mmu_notifier_range_init(range, start, end) _mmu_notifier_range_init(range, start, end)
#define mmu_notifier_range_init_owner(range, event, flags, vma, mm, start, \ #define mmu_notifier_range_init_owner(range, event, flags, mm, start, \
end, owner) \ end, owner) \
_mmu_notifier_range_init(range, start, end) _mmu_notifier_range_init(range, start, end)
......
...@@ -161,7 +161,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr, ...@@ -161,7 +161,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
int err; int err;
struct mmu_notifier_range range; struct mmu_notifier_range range;
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, mm, addr, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, addr,
addr + PAGE_SIZE); addr + PAGE_SIZE);
if (new_page) { if (new_page) {
......
...@@ -2020,7 +2020,7 @@ void __split_huge_pud(struct vm_area_struct *vma, pud_t *pud, ...@@ -2020,7 +2020,7 @@ void __split_huge_pud(struct vm_area_struct *vma, pud_t *pud,
spinlock_t *ptl; spinlock_t *ptl;
struct mmu_notifier_range range; struct mmu_notifier_range range;
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma->vm_mm,
address & HPAGE_PUD_MASK, address & HPAGE_PUD_MASK,
(address & HPAGE_PUD_MASK) + HPAGE_PUD_SIZE); (address & HPAGE_PUD_MASK) + HPAGE_PUD_SIZE);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
...@@ -2282,7 +2282,7 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd, ...@@ -2282,7 +2282,7 @@ void __split_huge_pmd(struct vm_area_struct *vma, pmd_t *pmd,
spinlock_t *ptl; spinlock_t *ptl;
struct mmu_notifier_range range; struct mmu_notifier_range range;
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma->vm_mm,
address & HPAGE_PMD_MASK, address & HPAGE_PMD_MASK,
(address & HPAGE_PMD_MASK) + HPAGE_PMD_SIZE); (address & HPAGE_PMD_MASK) + HPAGE_PMD_SIZE);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
......
...@@ -4966,7 +4966,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, ...@@ -4966,7 +4966,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src,
int ret = 0; int ret = 0;
if (cow) { if (cow) {
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, src_vma, src, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, src,
src_vma->vm_start, src_vma->vm_start,
src_vma->vm_end); src_vma->vm_end);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
...@@ -5177,7 +5177,7 @@ int move_hugetlb_page_tables(struct vm_area_struct *vma, ...@@ -5177,7 +5177,7 @@ int move_hugetlb_page_tables(struct vm_area_struct *vma,
struct mmu_notifier_range range; struct mmu_notifier_range range;
bool shared_pmd = false; bool shared_pmd = false;
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, mm, old_addr, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, old_addr,
old_end); old_end);
adjust_range_if_pmd_sharing_possible(vma, &range.start, &range.end); adjust_range_if_pmd_sharing_possible(vma, &range.start, &range.end);
/* /*
...@@ -5391,7 +5391,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, ...@@ -5391,7 +5391,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start,
struct mmu_notifier_range range; struct mmu_notifier_range range;
struct mmu_gather tlb; struct mmu_gather tlb;
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma->vm_mm,
start, end); start, end);
adjust_range_if_pmd_sharing_possible(vma, &range.start, &range.end); adjust_range_if_pmd_sharing_possible(vma, &range.start, &range.end);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
...@@ -5597,7 +5597,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma, ...@@ -5597,7 +5597,7 @@ static vm_fault_t hugetlb_wp(struct mm_struct *mm, struct vm_area_struct *vma,
pages_per_huge_page(h)); pages_per_huge_page(h));
__SetPageUptodate(new_page); __SetPageUptodate(new_page);
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, mm, haddr, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, haddr,
haddr + huge_page_size(h)); haddr + huge_page_size(h));
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
...@@ -6637,7 +6637,7 @@ long hugetlb_change_protection(struct vm_area_struct *vma, ...@@ -6637,7 +6637,7 @@ long hugetlb_change_protection(struct vm_area_struct *vma,
* range if PMD sharing is possible. * range if PMD sharing is possible.
*/ */
mmu_notifier_range_init(&range, MMU_NOTIFY_PROTECTION_VMA, mmu_notifier_range_init(&range, MMU_NOTIFY_PROTECTION_VMA,
0, vma, mm, start, end); 0, mm, start, end);
adjust_range_if_pmd_sharing_possible(vma, &range.start, &range.end); adjust_range_if_pmd_sharing_possible(vma, &range.start, &range.end);
BUG_ON(address >= end); BUG_ON(address >= end);
...@@ -7368,7 +7368,7 @@ static void hugetlb_unshare_pmds(struct vm_area_struct *vma, ...@@ -7368,7 +7368,7 @@ static void hugetlb_unshare_pmds(struct vm_area_struct *vma,
* No need to call adjust_range_if_pmd_sharing_possible(), because * No need to call adjust_range_if_pmd_sharing_possible(), because
* we have already done the PUD_SIZE alignment. * we have already done the PUD_SIZE alignment.
*/ */
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, mm, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm,
start, end); start, end);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
hugetlb_vma_lock_write(vma); hugetlb_vma_lock_write(vma);
......
...@@ -1040,8 +1040,8 @@ static int collapse_huge_page(struct mm_struct *mm, unsigned long address, ...@@ -1040,8 +1040,8 @@ static int collapse_huge_page(struct mm_struct *mm, unsigned long address,
anon_vma_lock_write(vma->anon_vma); anon_vma_lock_write(vma->anon_vma);
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, address,
address, address + HPAGE_PMD_SIZE); address + HPAGE_PMD_SIZE);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
pte = pte_offset_map(pmd, address); pte = pte_offset_map(pmd, address);
...@@ -1412,7 +1412,7 @@ static void collapse_and_free_pmd(struct mm_struct *mm, struct vm_area_struct *v ...@@ -1412,7 +1412,7 @@ static void collapse_and_free_pmd(struct mm_struct *mm, struct vm_area_struct *v
if (vma->anon_vma) if (vma->anon_vma)
lockdep_assert_held_write(&vma->anon_vma->root->rwsem); lockdep_assert_held_write(&vma->anon_vma->root->rwsem);
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, NULL, mm, addr, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, addr,
addr + HPAGE_PMD_SIZE); addr + HPAGE_PMD_SIZE);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
pmd = pmdp_collapse_flush(vma, addr, pmdp); pmd = pmdp_collapse_flush(vma, addr, pmdp);
......
...@@ -1057,8 +1057,7 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page, ...@@ -1057,8 +1057,7 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page,
BUG_ON(PageTransCompound(page)); BUG_ON(PageTransCompound(page));
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, mm, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, pvmw.address,
pvmw.address,
pvmw.address + PAGE_SIZE); pvmw.address + PAGE_SIZE);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
...@@ -1164,7 +1163,7 @@ static int replace_page(struct vm_area_struct *vma, struct page *page, ...@@ -1164,7 +1163,7 @@ static int replace_page(struct vm_area_struct *vma, struct page *page,
if (!pmd_present(pmde) || pmd_trans_huge(pmde)) if (!pmd_present(pmde) || pmd_trans_huge(pmde))
goto out; goto out;
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, mm, addr, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm, addr,
addr + PAGE_SIZE); addr + PAGE_SIZE);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
......
...@@ -765,7 +765,7 @@ static int madvise_free_single_vma(struct vm_area_struct *vma, ...@@ -765,7 +765,7 @@ static int madvise_free_single_vma(struct vm_area_struct *vma,
range.end = min(vma->vm_end, end_addr); range.end = min(vma->vm_end, end_addr);
if (range.end <= vma->vm_start) if (range.end <= vma->vm_start)
return -EINVAL; return -EINVAL;
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, mm, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm,
range.start, range.end); range.start, range.end);
lru_add_drain(); lru_add_drain();
......
...@@ -191,7 +191,7 @@ static int wp_clean_pre_vma(unsigned long start, unsigned long end, ...@@ -191,7 +191,7 @@ static int wp_clean_pre_vma(unsigned long start, unsigned long end,
wpwalk->tlbflush_end = start; wpwalk->tlbflush_end = start;
mmu_notifier_range_init(&wpwalk->range, MMU_NOTIFY_PROTECTION_PAGE, 0, mmu_notifier_range_init(&wpwalk->range, MMU_NOTIFY_PROTECTION_PAGE, 0,
walk->vma, walk->mm, start, end); walk->mm, start, end);
mmu_notifier_invalidate_range_start(&wpwalk->range); mmu_notifier_invalidate_range_start(&wpwalk->range);
flush_cache_range(walk->vma, start, end); flush_cache_range(walk->vma, start, end);
......
...@@ -1266,7 +1266,7 @@ copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma) ...@@ -1266,7 +1266,7 @@ copy_page_range(struct vm_area_struct *dst_vma, struct vm_area_struct *src_vma)
if (is_cow) { if (is_cow) {
mmu_notifier_range_init(&range, MMU_NOTIFY_PROTECTION_PAGE, mmu_notifier_range_init(&range, MMU_NOTIFY_PROTECTION_PAGE,
0, src_vma, src_mm, addr, end); 0, src_mm, addr, end);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
/* /*
* Disabling preemption is not needed for the write side, as * Disabling preemption is not needed for the write side, as
...@@ -1683,7 +1683,7 @@ void unmap_vmas(struct mmu_gather *tlb, struct maple_tree *mt, ...@@ -1683,7 +1683,7 @@ void unmap_vmas(struct mmu_gather *tlb, struct maple_tree *mt,
}; };
MA_STATE(mas, mt, vma->vm_end, vma->vm_end); MA_STATE(mas, mt, vma->vm_end, vma->vm_end);
mmu_notifier_range_init(&range, MMU_NOTIFY_UNMAP, 0, vma, vma->vm_mm, mmu_notifier_range_init(&range, MMU_NOTIFY_UNMAP, 0, vma->vm_mm,
start_addr, end_addr); start_addr, end_addr);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
do { do {
...@@ -1709,7 +1709,7 @@ void zap_page_range_single(struct vm_area_struct *vma, unsigned long address, ...@@ -1709,7 +1709,7 @@ void zap_page_range_single(struct vm_area_struct *vma, unsigned long address,
struct mmu_gather tlb; struct mmu_gather tlb;
lru_add_drain(); lru_add_drain();
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma->vm_mm,
address, end); address, end);
if (is_vm_hugetlb_page(vma)) if (is_vm_hugetlb_page(vma))
adjust_range_if_pmd_sharing_possible(vma, &range.start, adjust_range_if_pmd_sharing_possible(vma, &range.start,
...@@ -3091,7 +3091,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) ...@@ -3091,7 +3091,7 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf)
__SetPageUptodate(new_page); __SetPageUptodate(new_page);
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, mm, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, mm,
vmf->address & PAGE_MASK, vmf->address & PAGE_MASK,
(vmf->address & PAGE_MASK) + PAGE_SIZE); (vmf->address & PAGE_MASK) + PAGE_SIZE);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
...@@ -3561,7 +3561,7 @@ static vm_fault_t remove_device_exclusive_entry(struct vm_fault *vmf) ...@@ -3561,7 +3561,7 @@ static vm_fault_t remove_device_exclusive_entry(struct vm_fault *vmf)
if (!folio_lock_or_retry(folio, vma->vm_mm, vmf->flags)) if (!folio_lock_or_retry(folio, vma->vm_mm, vmf->flags))
return VM_FAULT_RETRY; return VM_FAULT_RETRY;
mmu_notifier_range_init_owner(&range, MMU_NOTIFY_EXCLUSIVE, 0, vma, mmu_notifier_range_init_owner(&range, MMU_NOTIFY_EXCLUSIVE, 0,
vma->vm_mm, vmf->address & PAGE_MASK, vma->vm_mm, vmf->address & PAGE_MASK,
(vmf->address & PAGE_MASK) + PAGE_SIZE, NULL); (vmf->address & PAGE_MASK) + PAGE_SIZE, NULL);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
......
...@@ -306,7 +306,7 @@ static void migrate_vma_collect(struct migrate_vma *migrate) ...@@ -306,7 +306,7 @@ static void migrate_vma_collect(struct migrate_vma *migrate)
* private page mappings that won't be migrated. * private page mappings that won't be migrated.
*/ */
mmu_notifier_range_init_owner(&range, MMU_NOTIFY_MIGRATE, 0, mmu_notifier_range_init_owner(&range, MMU_NOTIFY_MIGRATE, 0,
migrate->vma, migrate->vma->vm_mm, migrate->start, migrate->end, migrate->vma->vm_mm, migrate->start, migrate->end,
migrate->pgmap_owner); migrate->pgmap_owner);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
...@@ -733,7 +733,7 @@ static void __migrate_device_pages(unsigned long *src_pfns, ...@@ -733,7 +733,7 @@ static void __migrate_device_pages(unsigned long *src_pfns,
notified = true; notified = true;
mmu_notifier_range_init_owner(&range, mmu_notifier_range_init_owner(&range,
MMU_NOTIFY_MIGRATE, 0, migrate->vma, MMU_NOTIFY_MIGRATE, 0,
migrate->vma->vm_mm, addr, migrate->end, migrate->vma->vm_mm, addr, migrate->end,
migrate->pgmap_owner); migrate->pgmap_owner);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
......
...@@ -1120,13 +1120,3 @@ void mmu_notifier_synchronize(void) ...@@ -1120,13 +1120,3 @@ void mmu_notifier_synchronize(void)
synchronize_srcu(&srcu); synchronize_srcu(&srcu);
} }
EXPORT_SYMBOL_GPL(mmu_notifier_synchronize); EXPORT_SYMBOL_GPL(mmu_notifier_synchronize);
bool
mmu_notifier_range_update_to_read_only(const struct mmu_notifier_range *range)
{
if (!range->vma || range->event != MMU_NOTIFY_PROTECTION_VMA)
return false;
/* Return true if the vma still have the read flag set. */
return range->vma->vm_flags & VM_READ;
}
EXPORT_SYMBOL_GPL(mmu_notifier_range_update_to_read_only);
...@@ -398,7 +398,7 @@ static inline long change_pmd_range(struct mmu_gather *tlb, ...@@ -398,7 +398,7 @@ static inline long change_pmd_range(struct mmu_gather *tlb,
if (!range.start) { if (!range.start) {
mmu_notifier_range_init(&range, mmu_notifier_range_init(&range,
MMU_NOTIFY_PROTECTION_VMA, 0, MMU_NOTIFY_PROTECTION_VMA, 0,
vma, vma->vm_mm, addr, end); vma->vm_mm, addr, end);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
} }
......
...@@ -498,7 +498,7 @@ unsigned long move_page_tables(struct vm_area_struct *vma, ...@@ -498,7 +498,7 @@ unsigned long move_page_tables(struct vm_area_struct *vma,
new_addr, len); new_addr, len);
flush_cache_range(vma, old_addr, old_end); flush_cache_range(vma, old_addr, old_end);
mmu_notifier_range_init(&range, MMU_NOTIFY_UNMAP, 0, vma, vma->vm_mm, mmu_notifier_range_init(&range, MMU_NOTIFY_UNMAP, 0, vma->vm_mm,
old_addr, old_end); old_addr, old_end);
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
......
...@@ -542,7 +542,7 @@ static bool __oom_reap_task_mm(struct mm_struct *mm) ...@@ -542,7 +542,7 @@ static bool __oom_reap_task_mm(struct mm_struct *mm)
struct mmu_gather tlb; struct mmu_gather tlb;
mmu_notifier_range_init(&range, MMU_NOTIFY_UNMAP, 0, mmu_notifier_range_init(&range, MMU_NOTIFY_UNMAP, 0,
vma, mm, vma->vm_start, mm, vma->vm_start,
vma->vm_end); vma->vm_end);
tlb_gather_mmu(&tlb, mm); tlb_gather_mmu(&tlb, mm);
if (mmu_notifier_invalidate_range_start_nonblock(&range)) { if (mmu_notifier_invalidate_range_start_nonblock(&range)) {
......
...@@ -944,9 +944,8 @@ static int page_vma_mkclean_one(struct page_vma_mapped_walk *pvmw) ...@@ -944,9 +944,8 @@ static int page_vma_mkclean_one(struct page_vma_mapped_walk *pvmw)
* We have to assume the worse case ie pmd for invalidation. Note that * We have to assume the worse case ie pmd for invalidation. Note that
* the folio can not be freed from this function. * the folio can not be freed from this function.
*/ */
mmu_notifier_range_init(&range, MMU_NOTIFY_PROTECTION_PAGE, mmu_notifier_range_init(&range, MMU_NOTIFY_PROTECTION_PAGE, 0,
0, vma, vma->vm_mm, address, vma->vm_mm, address, vma_address_end(pvmw));
vma_address_end(pvmw));
mmu_notifier_invalidate_range_start(&range); mmu_notifier_invalidate_range_start(&range);
while (page_vma_mapped_walk(pvmw)) { while (page_vma_mapped_walk(pvmw)) {
...@@ -1475,7 +1474,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma, ...@@ -1475,7 +1474,7 @@ static bool try_to_unmap_one(struct folio *folio, struct vm_area_struct *vma,
* try_to_unmap() must hold a reference on the folio. * try_to_unmap() must hold a reference on the folio.
*/ */
range.end = vma_address_end(&pvmw); range.end = vma_address_end(&pvmw);
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma->vm_mm,
address, range.end); address, range.end);
if (folio_test_hugetlb(folio)) { if (folio_test_hugetlb(folio)) {
/* /*
...@@ -1850,7 +1849,7 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma, ...@@ -1850,7 +1849,7 @@ static bool try_to_migrate_one(struct folio *folio, struct vm_area_struct *vma,
* try_to_unmap() must hold a reference on the page. * try_to_unmap() must hold a reference on the page.
*/ */
range.end = vma_address_end(&pvmw); range.end = vma_address_end(&pvmw);
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, vma->vm_mm, mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma->vm_mm,
address, range.end); address, range.end);
if (folio_test_hugetlb(folio)) { if (folio_test_hugetlb(folio)) {
/* /*
...@@ -2180,7 +2179,7 @@ static bool page_make_device_exclusive_one(struct folio *folio, ...@@ -2180,7 +2179,7 @@ static bool page_make_device_exclusive_one(struct folio *folio,
swp_entry_t entry; swp_entry_t entry;
pte_t swp_pte; pte_t swp_pte;
mmu_notifier_range_init_owner(&range, MMU_NOTIFY_EXCLUSIVE, 0, vma, mmu_notifier_range_init_owner(&range, MMU_NOTIFY_EXCLUSIVE, 0,
vma->vm_mm, address, min(vma->vm_end, vma->vm_mm, address, min(vma->vm_end,
address + folio_size(folio)), address + folio_size(folio)),
args->owner); args->owner);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment