Re: [RFC PATCH] mm: filemap: avoid unnecessary major faults in filemap_fault()

From: zhangpeng (AS)
Date: Fri Nov 24 2023 - 02:43:24 EST


On 2023/11/24 14:05, Matthew Wilcox wrote:

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.

I'm also curious. Could ptep_modify_prot_start() of other architectures
(except ppc) not clear pte? We are mainly concerned with arm64 and x86.

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;
}

/*


--
Best Regards,
Peng