Message ID | 20230130125504.2509710-2-fengwei.yin@intel.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | folio based filemap_map_pages() | expand |
On Mon, Jan 30, 2023 at 08:55:00PM +0800, Yin Fengwei wrote: > Allow the batched page table population added to fault > around handler and benefit both file read and shared > fault. > > Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> Perhaps the performance effect of this patch should go into this patch's description since it's so dramatic? I would change-log this as: The shared fault handler can also benefit from fault-around. While it is uncommon to write to MAP_SHARED files, applications that do will see a huge benefit with will-it-scale:page_fault3 (shared file write fault) improving by 375%.
On 1/30/2023 9:21 PM, Matthew Wilcox wrote: > On Mon, Jan 30, 2023 at 08:55:00PM +0800, Yin Fengwei wrote: >> Allow the batched page table population added to fault >> around handler and benefit both file read and shared >> fault. >> >> Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> > > Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org> > > Perhaps the performance effect of this patch should go into this patch's > description since it's so dramatic? I would change-log this as: > > The shared fault handler can also benefit from fault-around. While it > is uncommon to write to MAP_SHARED files, applications that do will see > a huge benefit with will-it-scale:page_fault3 (shared file write fault) > improving by 375%. Thanks a lot for reviewing. I will update the commit message. Regards Yin, Fengwei
diff --git a/mm/memory.c b/mm/memory.c index ec833a2e0601..61ccd2d7e6a6 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -4545,6 +4545,17 @@ static vm_fault_t do_shared_fault(struct vm_fault *vmf) struct vm_area_struct *vma = vmf->vma; vm_fault_t ret, tmp; + /* + * Let's call ->map_pages() first and use ->fault() as fallback + * if page by the offset is not ready to be mapped (cold cache or + * something). + */ + if (should_fault_around(vmf)) { + ret = do_fault_around(vmf); + if (ret) + return ret; + } + ret = __do_fault(vmf); if (unlikely(ret & (VM_FAULT_ERROR | VM_FAULT_NOPAGE | VM_FAULT_RETRY))) return ret;
Allow the batched page table population added to fault around handler and benefit both file read and shared fault. Signed-off-by: Yin Fengwei <fengwei.yin@intel.com> --- mm/memory.c | 11 +++++++++++ 1 file changed, 11 insertions(+)