Commit f7842747 authored by Paolo Bonzini's avatar Paolo Bonzini

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: default avatarPaolo Bonzini <pbonzini@redhat.com>
Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
Reviewed-by: default avatarPhilippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20240405115815.3226315-5-pbonzini@redhat.com>
Acked-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
parent 997308f9
...@@ -657,6 +657,4 @@ static inline void mmu_notifier_synchronize(void) ...@@ -657,6 +657,4 @@ static inline void mmu_notifier_synchronize(void)
#endif /* CONFIG_MMU_NOTIFIER */ #endif /* CONFIG_MMU_NOTIFIER */
#define set_pte_at_notify set_pte_at
#endif /* _LINUX_MMU_NOTIFIER_H */ #endif /* _LINUX_MMU_NOTIFIER_H */
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
#include <linux/sched/coredump.h> #include <linux/sched/coredump.h>
#include <linux/export.h> #include <linux/export.h>
#include <linux/rmap.h> /* anon_vma_prepare */ #include <linux/rmap.h> /* anon_vma_prepare */
#include <linux/mmu_notifier.h> /* set_pte_at_notify */ #include <linux/mmu_notifier.h>
#include <linux/swap.h> /* folio_free_swap */ #include <linux/swap.h> /* folio_free_swap */
#include <linux/ptrace.h> /* user_enable_single_step */ #include <linux/ptrace.h> /* user_enable_single_step */
#include <linux/kdebug.h> /* notifier mechanism */ #include <linux/kdebug.h> /* notifier mechanism */
...@@ -195,7 +195,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr, ...@@ -195,7 +195,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr,
flush_cache_page(vma, addr, pte_pfn(ptep_get(pvmw.pte))); flush_cache_page(vma, addr, pte_pfn(ptep_get(pvmw.pte)));
ptep_clear_flush(vma, addr, pvmw.pte); ptep_clear_flush(vma, addr, pvmw.pte);
if (new_page) if (new_page)
set_pte_at_notify(mm, addr, pvmw.pte, set_pte_at(mm, addr, pvmw.pte,
mk_pte(new_page, vma->vm_page_prot)); mk_pte(new_page, vma->vm_page_prot));
folio_remove_rmap_pte(old_folio, old_page, vma); folio_remove_rmap_pte(old_folio, old_page, vma);
......
...@@ -1345,7 +1345,7 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page, ...@@ -1345,7 +1345,7 @@ static int write_protect_page(struct vm_area_struct *vma, struct page *page,
if (pte_write(entry)) if (pte_write(entry))
entry = pte_wrprotect(entry); entry = pte_wrprotect(entry);
set_pte_at_notify(mm, pvmw.address, pvmw.pte, entry); set_pte_at(mm, pvmw.address, pvmw.pte, entry);
} }
*orig_pte = entry; *orig_pte = entry;
err = 0; err = 0;
...@@ -1447,7 +1447,7 @@ static int replace_page(struct vm_area_struct *vma, struct page *page, ...@@ -1447,7 +1447,7 @@ static int replace_page(struct vm_area_struct *vma, struct page *page,
* See Documentation/mm/mmu_notifier.rst * See Documentation/mm/mmu_notifier.rst
*/ */
ptep_clear_flush(vma, addr, ptep); ptep_clear_flush(vma, addr, ptep);
set_pte_at_notify(mm, addr, ptep, newpte); set_pte_at(mm, addr, ptep, newpte);
folio = page_folio(page); folio = page_folio(page);
folio_remove_rmap_pte(folio, page, vma); folio_remove_rmap_pte(folio, page, vma);
......
...@@ -3327,13 +3327,8 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf) ...@@ -3327,13 +3327,8 @@ static vm_fault_t wp_page_copy(struct vm_fault *vmf)
ptep_clear_flush(vma, vmf->address, vmf->pte); ptep_clear_flush(vma, vmf->address, vmf->pte);
folio_add_new_anon_rmap(new_folio, vma, vmf->address); folio_add_new_anon_rmap(new_folio, vma, vmf->address);
folio_add_lru_vma(new_folio, vma); folio_add_lru_vma(new_folio, vma);
/*
* We call the notify macro here because, when using secondary
* mmu page tables (such as kvm shadow page tables), we want the
* new page to be mapped directly into the secondary page table.
*/
BUG_ON(unshare && pte_write(entry)); BUG_ON(unshare && pte_write(entry));
set_pte_at_notify(mm, vmf->address, vmf->pte, entry); set_pte_at(mm, vmf->address, vmf->pte, entry);
update_mmu_cache_range(vmf, vma, vmf->address, vmf->pte, 1); update_mmu_cache_range(vmf, vma, vmf->address, vmf->pte, 1);
if (old_folio) { if (old_folio) {
/* /*
......
...@@ -664,13 +664,9 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate, ...@@ -664,13 +664,9 @@ static void migrate_vma_insert_page(struct migrate_vma *migrate,
if (flush) { if (flush) {
flush_cache_page(vma, addr, pte_pfn(orig_pte)); flush_cache_page(vma, addr, pte_pfn(orig_pte));
ptep_clear_flush(vma, addr, ptep); ptep_clear_flush(vma, addr, ptep);
set_pte_at_notify(mm, addr, ptep, entry); }
update_mmu_cache(vma, addr, ptep);
} else {
/* No need to invalidate - it was non-present before */
set_pte_at(mm, addr, ptep, entry); set_pte_at(mm, addr, ptep, entry);
update_mmu_cache(vma, addr, ptep); update_mmu_cache(vma, addr, ptep);
}
pte_unmap_unlock(ptep, ptl); pte_unmap_unlock(ptep, ptl);
*src = MIGRATE_PFN_MIGRATE; *src = MIGRATE_PFN_MIGRATE;
......
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