On 1/23/23 09:33, Matthew Wilcox wrote: ...
Bleh, I'd forgotten about that problem. We really do need to keep track of which pages are under I/O for this case, because we need to tell the filesystem that they are now available for writeback. That said, I don't know that we need to keep track of it in the pages themselves. Can't we have something similar to rmap which keeps track of a range of pinned pages, and have it taken care of at a higher level (ie unpin the pages in the dio_iodone_t rather than in the BIO completion handler)? I'm not even sure why pinned pagecache pages remain on the LRU. They should probably go onto the unevictable list with the mlocked
This is an intriguing idea, but...
pages, then on unpin get marked dirty and placed on the active list. There's no point in writing back a pinned page since it can be written to at any instant without any part of the kernel knowing.
There have been filesystems discussions about this: if a page goes unwritten for "too long", it's not good. To address that, bounce buffers were proposed for periodic writeback of pinned pages. The idea with bounce buffers is: even though the page is never guaranteed up to date (because DMA can instantly make it effectively dirty), it is at least much less out of date after a periodic writeback, then it was before. And that is important for some file system use cases. thanks, -- John Hubbard NVIDIA