Skip to content

Commit f784274

Browse files
committed
mm: replace set_pte_at_notify() with just set_pte_at()
With the demise of the .change_pte() MMU notifier callback, there is no notification happening in set_pte_at_notify(). It is a synonym of set_pte_at() and can be replaced with it. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Reviewed-by: David Hildenbrand <david@redhat.com> Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Message-ID: <20240405115815.3226315-5-pbonzini@redhat.com> Acked-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
1 parent 997308f commit f784274

5 files changed

Lines changed: 8 additions & 19 deletions

File tree

include/linux/mmu_notifier.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,4 @@ static inline void mmu_notifier_synchronize(void)
657657

658658
#endif /* CONFIG_MMU_NOTIFIER */
659659

660-
#define set_pte_at_notify set_pte_at
661-
662660
#endif /* _LINUX_MMU_NOTIFIER_H */

kernel/events/uprobes.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <linux/sched/coredump.h>
1919
#include <linux/export.h>
2020
#include <linux/rmap.h> /* anon_vma_prepare */
21-
#include <linux/mmu_notifier.h> /* set_pte_at_notify */
21+
#include <linux/mmu_notifier.h>
2222
#include <linux/swap.h> /* folio_free_swap */
2323
#include <linux/ptrace.h> /* user_enable_single_step */
2424
#include <linux/kdebug.h> /* notifier mechanism */
@@ -195,8 +195,8 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
195195
flush_cache_page(vma, addr, pte_pfn(ptep_get(pvmw.pte)));
196196
ptep_clear_flush(vma, addr, pvmw.pte);
197197
if (new_page)
198-
set_pte_at_notify(mm, addr, pvmw.pte,
199-
mk_pte(new_page, vma->vm_page_prot));
198+
set_pte_at(mm, addr, pvmw.pte,
199+
mk_pte(new_page, vma->vm_page_prot));
200200

201201
folio_remove_rmap_pte(old_folio, old_page, vma);
202202
if (!folio_mapped(old_folio))

mm/ksm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,7 +1345,7 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page,
13451345
if (pte_write(entry))
13461346
entry = pte_wrprotect(entry);
13471347

1348-
set_pte_at_notify(mm, pvmw.address, pvmw.pte, entry);
1348+
set_pte_at(mm, pvmw.address, pvmw.pte, entry);
13491349
}
13501350
*orig_pte = entry;
13511351
err = 0;
@@ -1447,7 +1447,7 @@ static int replace_page(struct vm_area_struct *vma, struct page *page,
14471447
* See Documentation/mm/mmu_notifier.rst
14481448
*/
14491449
ptep_clear_flush(vma, addr, ptep);
1450-
set_pte_at_notify(mm, addr, ptep, newpte);
1450+
set_pte_at(mm, addr, ptep, newpte);
14511451

14521452
folio = page_folio(page);
14531453
folio_remove_rmap_pte(folio, page, vma);

mm/memory.c

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3327,13 +3327,8 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf)
33273327
ptep_clear_flush(vma, vmf->address, vmf->pte);
33283328
folio_add_new_anon_rmap(new_folio, vma, vmf->address);
33293329
folio_add_lru_vma(new_folio, vma);
3330-
/*
3331-
* We call the notify macro here because, when using secondary
3332-
* mmu page tables (such as kvm shadow page tables), we want the
3333-
* new page to be mapped directly into the secondary page table.
3334-
*/
33353330
BUG_ON(unshare && pte_write(entry));
3336-
set_pte_at_notify(mm, vmf->address, vmf->pte, entry);
3331+
set_pte_at(mm, vmf->address, vmf->pte, entry);
33373332
update_mmu_cache_range(vmf, vma, vmf->address, vmf->pte, 1);
33383333
if (old_folio) {
33393334
/*

mm/migrate_device.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -664,13 +664,9 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,
664664
if (flush) {
665665
flush_cache_page(vma, addr, pte_pfn(orig_pte));
666666
ptep_clear_flush(vma, addr, ptep);
667-
set_pte_at_notify(mm, addr, ptep, entry);
668-
update_mmu_cache(vma, addr, ptep);
669-
} else {
670-
/* No need to invalidate - it was non-present before */
671-
set_pte_at(mm, addr, ptep, entry);
672-
update_mmu_cache(vma, addr, ptep);
673667
}
668+
set_pte_at(mm, addr, ptep, entry);
669+
update_mmu_cache(vma, addr, ptep);
674670

675671
pte_unmap_unlock(ptep, ptl);
676672
*src = MIGRATE_PFN_MIGRATE;

0 commit comments

Comments
 (0)