Re: [PATCH 1/2] mm: Allow architectures to request 'old' entries when prefaulting
From: Matthew Wilcox
Date: Wed Dec 09 2020 - 15:32:56 EST
On Wed, Dec 09, 2020 at 11:04:13AM -0800, Linus Torvalds wrote:
> In particular, it made it a nightmare to read what do_fault_around()
> does: it does that odd
>
> if (pmd_none(*vmf->pmd)) {
> vmf->prealloc_pte = pte_alloc_one(vmf->vma->vm_mm);
>
> and then it calls ->map_pages() (which is always filemap_map_pages(),
> except for xfs, where it is also always filemap_map_pages but it takes
> a lock first).
... which is wrong. Dave's paranoia around other people
introducing bugs into XFS made him do this, but we should revert
cd647d5651c0b0deaa26c1acb9e1789437ba9bc7. Those operations he's
worried about are protected by the page lock.
If a filesystem has put an Uptodate page into the page cache, the
rest of the kernel can read it without telling the filesystem.