Re: [RFC PATCH] mm: filemap: avoid unnecessary major faults in filemap_fault()
From: Matthew Wilcox
Date: Fri Nov 24 2023 - 01:08:20 EST
On Wed, Nov 22, 2023 at 10:00:52PM +0800, Peng Zhang wrote:
> From: ZhangPeng <zhangpeng362@xxxxxxxxxx>
>
> The major fault occurred when using mlockall(MCL_CURRENT | MCL_FUTURE)
> in application, which leading to an unexpected performance issue[1].
>
> This caused by temporarily cleared pte during a read/modify/write update
> of the pte, eg, do_numa_page()/change_pte_range().
What I haven't quite understood yet is why we need to set the pte to
zero on x86 in the specific case of do_numa_page(). I understand that
ppc needs to.
Could someone explain why the _default_ definition of
ptep_modify_prot_start() is not:
+++ b/include/linux/pgtable.h
@@ -1074,7 +1074,7 @@ static inline pte_t ptep_modify_prot_start(struct vm_area_struct *vma,
unsigned long addr,
pte_t *ptep)
{
- return __ptep_modify_prot_start(vma, addr, ptep);
+ return *ptep;
}
/*