mm: add and use find_lock_entries

Linux Kernel / Linux Kernel - Matthew Wilcox (Oracle) [] - 26 February 2021 17:40 UTC

We have three functions (shmem_undo_range(), truncate_inode_pages_range() and invalidate_mapping_pages()) which want exactly this function, so add it to filemap.c. Before this patch, shmem_undo_range() would split any compound page which overlaps either end of the range being punched in both the first and second loops through the address space. After this patch, that functionality is left for the second loop, which is arguably more appropriate since the first loop is supposed to run through all the pages quickly, and splitting a page can sleep.

[ add assertion] Link:


5c211ba29deb mm: add and use find_lock_entries
mm/filemap.c | 59 ++++++++++++++++++++++++++++++++++++++
mm/internal.h | 3 ++
mm/shmem.c | 22 ++++-----------
mm/truncate.c | 91 ++++++++---------------------------------------------------
4 files changed, 78 insertions(+), 97 deletions(-)


  • Share