Re: [PATCH v11 09/12] mm: implement LUF(Lazy Unmap Flush) defering tlb flush when folios get unmapped

From: Dave Hansen
Date: Mon Jun 03 2024 - 12:37:58 EST


On 6/3/24 09:05, David Hildenbrand wrote:
...
>>    2. A LUF'd page's position in the page cache can't be replaced until
>>       after a luf_flush()
>
> That's the most tricky bit. I think these are the VFS concerns like
>
> 1) Page migration/reclaim ends up freeing the old page. TLB not flushed.
> 2) write() to the new page / write from other process to the new page
> 3) CPU reads stale content from old page
>
> PTE markers can't handle that.

Yeah, we'd need some equivalent of a PTE marker, but for the page cache.
Presumably some xa_value() that means a reader has to go do a
luf_flush() before going any farther.

That would actually have a chance at fixing two issues: One where a new
page cache insertion is attempted. The other where someone goes to look
in the page cache and takes some action _because_ it is empty (I think
NFS is doing some of this for file locks).

LUF is also pretty fundamentally built on the idea that files can't
change without LUF being aware. That model seems to work decently for
normal old filesystems on normal old local block devices. I'm worried
about NFS, and I don't know how seriously folks take FUSE, but it
obviously can't work well for FUSE.