On Wed, 2019-11-06 at 13:03 +0100, Jan Kara wrote: > On Tue 05-11-19 13:22:11, Johannes Weiner wrote: > > What I don't quite understand yet is why the fault path doesn't > > make > > progress eventually. We must drop the mmap_sem without changing the > > state in any way. How can we keep looping on the same page? > > That may be a slight suboptimality with Josef's patches. If the page > is marked as PageReadahead, we always drop mmap_sem if we can and > start > readahead without checking whether that makes sense or not in > do_async_mmap_readahead(). OTOH page_cache_async_readahead() then > clears > PageReadahead so the only way how I can see we could loop like this > is when > file->ra->ra_pages is 0. Not sure if that's what's happening through. > We'd > need to find which of the paths in filemap_fault() calls > maybe_unlock_mmap_for_io() to tell more. Yes, ra_pages==0 Attached the dmesg + smaps outputs [ 91.803976] _mm_populate 0 7ffffffff000 7ffffffff000 1 LOOP 5637e3a2b000 1 0 [ 91.803978] _mm_populate 0 7ffffffff000 7ffffffff000 1 vma- >vm_start=7fa32afe5000 vma->vm_end=7fa32b00a000 vma->vm_flags=8002071 [ 91.803980] _mm_populate 0 7ffffffff000 7ffffffff000 1 nend=7fa32b00a000 7ffffffff000 7fa32b00a000 [ 91.803981] __get_user_pages start=7fa32afe5000 nr_pages=37 gup_flags=1052 ctx.page_mask=0 [ 91.803982] __get_user_pages @1 vma==NULL [ 91.803984] __get_user_pages @2 start=7fa32afe5000 vma- >vm_start=7fa32afe5000 vma->vm_end=7fa32b00a000 vma->vm_flags=8002071 [ 91.803986] __get_user_pages @2 vma->vm_file->f_mode=80a801d ra.async_size=0 ra.ra_pages=0 ra.mmap_miss=0 ra.size=0 ra.start=0 ra.prev_pos=948 [ 91.803988] __get_user_pages @7 follow_page_mask --> 1 ctx.page_mask=0 [ 91.803989] __get_user_pages @9 page_increm=1 ctx.page_mask=0 [ 91.803990] __get_user_pages @10 i=1 start=7fa32afe6000 nr_pages=36 [ 91.803991] __get_user_pages @7 follow_page_mask --> 0 ctx.page_mask=0 [ 91.803996] faultin_page handle_mm_fault --> ret = 1024 [ 91.803997] faultin_page-->EBUSY VM_FAULT_RETRY non-blocking?1 FAULT_FLAG_RETRY_NOWAIT?0 [ 91.803998] __get_user_pages @8 faultin_page --> -16 [ 91.803999] __get_user_pages LEAVE i=1 ret=0 [ 91.804001] _mm_populate 0 7ffffffff000 7ffffffff000 1 LOOP-3 ret=1 nend=7fa32afe6000 [ 91.804002] _mm_populate 0 7ffffffff000 7ffffffff000 1 LOOP 7fa32afe6000 0 0 [ 91.804004] _mm_populate 0 7ffffffff000 7ffffffff000 1 vma- >vm_start=7fa32afe5000 vma->vm_end=7fa32b00a000 vma->vm_flags=8002071 [ 91.804006] _mm_populate 0 7ffffffff000 7ffffffff000 1 nend=7fa32b00a000 7ffffffff000 7fa32b00a000 [ 91.804007] __get_user_pages start=7fa32afe6000 nr_pages=36 gup_flags=1052 ctx.page_mask=0 [ 91.804008] __get_user_pages @1 vma==NULL [ 91.804010] __get_user_pages @2 start=7fa32afe6000 vma- >vm_start=7fa32afe5000 vma->vm_end=7fa32b00a000 vma->vm_flags=8002071 [ 91.804012] __get_user_pages @2 vma->vm_file->f_mode=80a801d ra.async_size=0 ra.ra_pages=0 ra.mmap_miss=0 ra.size=0 ra.start=0 ra.prev_pos=948 [ 91.804013] __get_user_pages @7 follow_page_mask --> 0 ctx.page_mask=0 [ 91.804016] faultin_page handle_mm_fault --> ret = 1024 [ 91.804017] faultin_page-->EBUSY VM_FAULT_RETRY non-blocking?1 FAULT_FLAG_RETRY_NOWAIT?0 [ 91.804018] __get_user_pages @8 faultin_page --> -16 [ 91.804019] __get_user_pages LEAVE i=0 ret=0 [ 91.804020] _mm_populate 0 7ffffffff000 7ffffffff000 1 LOOP-3 ret=0 nend=7fa32afe6000