Pull folio updates from Matthew Wilcox: - Rewrite how munlock works to massively reduce the contention on i_mmap_rwsem (Hugh Dickins): https://lore.kernel.org/linux-mm/8e4356d-9622-a7f0-b2c-f116b5f2efea@google.com/ - Sort out the page refcount mess for ZONE_DEVICE pages (Christoph Hellwig): https://lore.kernel.org/linux-mm/20220210072828.2930359-1-hch@lst.de/ - Convert GUP to use folios and make pincount available for order-1 pages. (Matthew Wilcox) - Convert a few more truncation functions to use folios (Matthew Wilcox) - Convert page_vma_mapped_walk to use PFNs instead of pages (Matthew Wilcox) - Convert rmap_walk to use folios (Matthew Wilcox) - Convert most of shrink_page_list() to use a folio (Matthew Wilcox) - Add support for creating large folios in readahead (Matthew Wilcox) * tag 'folio-5.18c' of git://git.infradead.org/users/willy/pagecache: (114 commits) mm/damon: minor cleanup for damon_pa_young selftests/vm/transhuge-stress: Support file-backed PMD folios mm/filemap: Support VM_HUGEPAGE for file mappings mm/readahead: Switch to page_cache_ra_order mm/readahead: Align file mappings for non-DAX mm/readahead: Add large folio readahead mm: Support arbitrary THP sizes mm: Make large folios depend on THP mm: Fix READ_ONLY_THP warning mm/filemap: Allow large folios to be added to the page cache mm: Turn can_split_huge_page() into can_split_folio() mm/vmscan: Convert pageout() to take a folio mm/vmscan: Turn page_check_references() into folio_check_references() mm/vmscan: Account large folios correctly mm/vmscan: Optimise shrink_page_list for non-PMD-sized folios mm/vmscan: Free non-shmem folios without splitting them mm/rmap: Constify the rmap_walk_control argument mm/rmap: Convert rmap_walk() to take a folio mm: Turn page_anon_vma() into folio_anon_vma() mm/rmap: Turn page_lock_anon_vma_read() into folio_lock_anon_vma_read() ...
Showing the changes to kernel (2 of 100 files). Show all
Unified · Split
| @@ -155,11 +155,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr, · 154 unmodified lines | |||
| 155 | struct page *old_page, struct page *new_page) | 155 | struct page *old_page, struct page *new_page) |
| 156 | { | 156 | { |
| 157 | struct mm_struct *mm = vma->vm_mm; | 157 | struct mm_struct *mm = vma->vm_mm; |
| 158 | struct page_vma_mapped_walk pvmw = { | 158 | DEFINE_FOLIO_VMA_WALK(pvmw, page_folio(old_page), vma, addr, 0); |
| 159 | .page = compound_head(old_page), | ||
| 160 | .vma = vma, | ||
| 161 | .address = addr, | ||
| 162 | }; | ||
| 163 | int err; | 159 | int err; |
| 164 | struct mmu_notifier_range range; | 160 | struct mmu_notifier_range range; |
| 165 | 161 | ||
| @@ -173,7 +169,7 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr, · 7 unmodified lines | |||
| 173 | return err; | 169 | return err; |
| 174 | } | 170 | } |
| 175 | 171 | ||
| 176 | /* For try_to_free_swap() and munlock_vma_page() below */ | 172 | /* For try_to_free_swap() below */ |
| 177 | lock_page(old_page); | 173 | lock_page(old_page); |
| 178 | 174 | ||
| 179 | mmu_notifier_invalidate_range_start(&range); | 175 | mmu_notifier_invalidate_range_start(&range); |
| @@ -201,13 +197,10 @@ static int __replace_page(struct vm_area_struct *vma, unsigned long addr, · 21 unmodified lines | |||
| 201 | set_pte_at_notify(mm, addr, pvmw.pte, | 197 | set_pte_at_notify(mm, addr, pvmw.pte, |
| 202 | mk_pte(new_page, vma->vm_page_prot)); | 198 | mk_pte(new_page, vma->vm_page_prot)); |
| 203 | 199 | ||
| 204 | page_remove_rmap(old_page, false); | 200 | page_remove_rmap(old_page, vma, false); |
| 205 | if (!page_mapped(old_page)) | 201 | if (!page_mapped(old_page)) |
| 206 | try_to_free_swap(old_page); | 202 | try_to_free_swap(old_page); |
| 207 | page_vma_mapped_walk_done(&pvmw); | 203 | page_vma_mapped_walk_done(&pvmw); |
| 208 | |||
| 209 | if ((vma->vm_flags & VM_LOCKED) && !PageCompound(old_page)) | ||
| 210 | munlock_vma_page(old_page); | ||
| 211 | put_page(old_page); | 204 | put_page(old_page); |
| 212 | 205 | ||
| 213 | err = 0; | 206 | err = 0; |
| @@ -302,7 +302,7 @@ again: · 301 unmodified lines | |||
| 302 | * found it, but truncated or holepunched or subjected to | 302 | * found it, but truncated or holepunched or subjected to |
| 303 | * invalidate_complete_page2 before we got the page lock (also | 303 | * invalidate_complete_page2 before we got the page lock (also |
| 304 | * cases which we are happy to fail). And we hold a reference, | 304 | * cases which we are happy to fail). And we hold a reference, |
| 305 | * so refcount care in invalidate_complete_page's remove_mapping | 305 | * so refcount care in invalidate_inode_page's remove_mapping |
| 306 | * prevents drop_caches from setting mapping to NULL beneath us. | 306 | * prevents drop_caches from setting mapping to NULL beneath us. |
| 307 | * | 307 | * |
| 308 | * The case we do have to guard against is when memory pressure made | 308 | * The case we do have to guard against is when memory pressure made |