fixup! BACKPORT: FROMGIT: hugetlb/userfaultfd: unshare all pmds for hugetlbfs when register wp

Commit 8013681a31 was incorrectly backported
to 4.19. We do not have upstream commit 5d6527a784f7a6d247961e046e830de8d71b47d1
(mm/mmu_notifier: use structure for invalidate_range_start/end callback) on
this version.

Instead, mmu_notifier_invalidate_range_start and mmu_notifier_invalidate_range_end
directly take in the start and end addresses of the range, so remove references
to mmu_notifier_range and pass start and end directly.

Change-Id: Iae54eea70fcbc985de938bcb49ee906324f3bea2
Signed-off-by: bengris32 <bengris32@protonmail.ch>
This commit is contained in:
bengris32
2025-09-21 23:06:14 +01:00
parent ca77b0c19b
commit 5fa1416882

View File

@@ -5129,7 +5129,6 @@ void hugetlb_unshare_all_pmds(struct vm_area_struct *vma)
struct hstate *h = hstate_vma(vma);
unsigned long sz = huge_page_size(h);
struct mm_struct *mm = vma->vm_mm;
struct mmu_notifier_range range;
unsigned long address, start, end;
spinlock_t *ptl;
pte_t *ptep;
@@ -5147,9 +5146,7 @@ void hugetlb_unshare_all_pmds(struct vm_area_struct *vma)
* No need to call adjust_range_if_pmd_sharing_possible(), because
* we have already done the PUD_SIZE alignment.
*/
mmu_notifier_range_init(&range, MMU_NOTIFY_CLEAR, 0, vma, mm,
start, end);
mmu_notifier_invalidate_range_start(&range);
mmu_notifier_invalidate_range_start(mm, start, end);
i_mmap_lock_write(vma->vm_file->f_mapping);
for (address = start; address < end; address += PUD_SIZE) {
unsigned long tmp = address;
@@ -5168,6 +5165,6 @@ void hugetlb_unshare_all_pmds(struct vm_area_struct *vma)
* No need to call mmu_notifier_invalidate_range(), see
* Documentation/vm/mmu_notifier.rst.
*/
mmu_notifier_invalidate_range_end(&range);
mmu_notifier_invalidate_range_end(mm, start, end);
}