On Sun 19-02-23 22:22:32, Christoph Hellwig wrote: > On Thu, Feb 16, 2023 at 01:33:16PM +0100, Jan Kara wrote: > > I'm a bit skeptical we can reasonably assess that (as much as I would love > > to just not write these pages and be done with it) because a lot of > > FOLL_LONGTERM users just pin passed userspace address range, then allow > > userspace to manipulate it with other operations, and finally unpin it with > > another call. Who knows whether shared pagecache pages are passed in and > > what userspace is doing with them while they are pinned? > > True. > > So what other sensible thing could we do at a higher level? > > Treat MAP_SHARED buffers that are long term registered as MAP_PRIVATE > while registered, and just do writeback using in-kernel O_DIRECT on > fsync? Do you mean to copy these pages on fsync(2) to newly allocated buffer and then submit it via direct IO? That looks sensible to me. We could then make writeback path just completely ignore these long term pinned pages and just add this copying logic into filemap_fdatawrite() or something like that. Honza -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR