summaryrefslogtreecommitdiff
path: root/mm/mmzone.c
diff options
context:
space:
mode:
authorHugh Dickins <hughd@google.com>2022-02-15 05:40:55 +0300
committerMatthew Wilcox (Oracle) <willy@infradead.org>2022-02-17 19:59:45 +0300
commit6d9df8a5889c569ab9e3bcb38b12e5b81b6b9bde (patch)
tree027372c9efe3f64cb5fbee730449c88c02c451f3 /mm/mmzone.c
parentb74355078b6554271371532a5daa3b1a3db620f9 (diff)
downloadlinux-6d9df8a5889c569ab9e3bcb38b12e5b81b6b9bde.tar.xz
mm/thp: collapse_file() do try_to_unmap(TTU_BATCH_FLUSH)
collapse_file() is using unmap_mapping_pages(1) on each small page found mapped, unlike others (reclaim, migration, splitting, memory-failure) who use try_to_unmap(). There are four advantages to try_to_unmap(): first, its TTU_IGNORE_MLOCK option now avoids leaving mlocked page in pagevec; second, its vma lookup uses i_mmap_lock_read() not i_mmap_lock_write(); third, it breaks out early if page is not mapped everywhere it might be; fourth, its TTU_BATCH_FLUSH option can be used, as in page reclaim, to save up all the TLB flushing until all of the pages have been unmapped. Wild guess: perhaps it was originally written to use try_to_unmap(), but hit the VM_BUG_ON_PAGE(page_mapped) after unmapping, because without TTU_SYNC it may skip page table locks; but unmap_mapping_pages() never skips them, so fixed the issue. I did once hit that VM_BUG_ON_PAGE() since making this change: we could pass TTU_SYNC here, but I think just delete the check - the race is very rare, this is an ordinary small page so we don't need to be so paranoid about mapcount surprises, and the page_ref_freeze() just below already handles the case adequately. Signed-off-by: Hugh Dickins <hughd@google.com> Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Diffstat (limited to 'mm/mmzone.c')
0 files changed, 0 insertions, 0 deletions