[PW_SID:1087860] mm: reduce mmap_lock contention and improve page fault performance#1845
[PW_SID:1087860] mm: reduce mmap_lock contention and improve page fault performance#1845linux-riscv-bot wants to merge 6 commits into
Conversation
If the current page fault is using the per-VMA lock, and we only released the lock to wait for I/O completion (e.g., using folio_lock()), then when the fault is retried after the I/O completes, it should still qualify for the per-VMA-lock path. Acked-by: Pedro Falcato <pfalcato@suse.de> Tested-by: Wang Lian <wanglian@kylinos.cn> Tested-by: Kunwu Chan <chentao@kylinos.cn> Reviewed-by: Wang Lian <lianux.mm@gmail.com> Reviewed-by: Kunwu Chan <kunwu.chan@gmail.com> Signed-off-by: Oven Liyang <liyangouwen1@oppo.com> Co-developed-by: Barry Song <baohua@kernel.org> Signed-off-by: Barry Song <baohua@kernel.org> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
If the current do_swap_page() took the per-VMA lock and we dropped it only to wait for I/O completion (e.g., use folio_wait_locked()), then when do_swap_page() is retried after the I/O completes, it should still qualify for the per-VMA-lock path. Tested-by: Wang Lian <wanglian@kylinos.cn> Tested-by: Kunwu Chan <chentao@kylinos.cn> Reviewed-by: Wang Lian <lianux.mm@gmail.com> Reviewed-by: Kunwu Chan <kunwu.chan@gmail.com> Signed-off-by: Barry Song (Xiaomi) <baohua@kernel.org> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
folio_lock_or_retry() is effectively only used in mm/memory.c, not in the filemap code. Move it there and make it static. The helper __folio_lock_or_retry() can be folded into folio_lock_or_retry(), allowing it to be removed. Signed-off-by: Barry Song (Xiaomi) <baohua@kernel.org> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
If we are waiting for long I/O to complete, it makes sense to avoid holding locks for too long. However, if the folio is uptodate, we are likely only waiting for a concurrent PTE update to finish. Retrying the entire page fault seems excessive. Signed-off-by: Barry Song (Xiaomi) <baohua@kernel.org> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
…faults For uptodate folios, we are not waiting on I/O. We should be able to acquire the folio lock shortly, so there is no need to drop per-vma locks and perform a full PF retry. Signed-off-by: Barry Song (Xiaomi) <baohua@kernel.org> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 1: "[v2,1/5] mm/filemap: Retry fault by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 2: "[v2,2/5] mm/swapin: Retry swapin by VMA lock if the lock was released for I/O" |
|
Patch 3: "[v2,3/5] mm: Move folio_lock_or_retry() and drop __folio_lock_or_retry()" |
|
Patch 3: "[v2,3/5] mm: Move folio_lock_or_retry() and drop __folio_lock_or_retry()" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 4: "[v2,4/5] mm: Don't retry page fault if folio is uptodate during swap-in" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
|
Patch 5: "[v2,5/5] mm/filemap: Avoid retrying page faults on uptodate folios in filemap faults" |
f190ec6 to
2c3b264
Compare
PR for series 1087860 applied to workflow__riscv__fixes
Name: mm: reduce mmap_lock contention and improve page fault performance
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1087860
Version: 2