On Thu 09-02-23 16:17:47, Matthew Wilcox wrote: > On Thu, Feb 09, 2023 at 01:31:53PM +0100, Jan Kara wrote: > > If the page is pinned, there's no point in trying to reclaim it. > > Furthermore if the page is from the page cache we don't want to reclaim > > fs-private data from the page because the pinning process may be writing > > to the page at any time and reclaiming fs private info on a dirty page > > can upset the filesystem (see link below). > > > > Link: https://lore.kernel.org/linux-mm/20180103100430.GE4911@xxxxxxxxxxxxxx > > OK, but now I'm confused. I've been told before that the reason we > can't take pinned pages off the LRU list is that they need to be written > back periodically for ... reasons. But now the pages are going to be > skipped if they're found on the LRU list, so why is this better than > taking them off the LRU list? You are mixing things together a bit :). Yes, we do need to writeback pinned pages from time to time - for data integrity purposes like fsync(2). This has nothing to do with taking the pinned page out of LRU. It would be actually nice to be able to take pinned pages out of the LRU and functionally that would make sense but as I've mentioned in my reply to you [1], the problem here is the performance. I've now dug out the discussion from 2018 where John actually tried to take pinned pages out of the LRU [2] and the result was 20% IOPS degradation on his NVME drive because of the cost of taking the LRU lock. I'm not even speaking how costly that would get on any heavily parallel direct IO workload on some high-iops device... Honza [1] https://lore.kernel.org/all/20230124102931.g7e33syuhfo7s36h@quack3 [2] https://lore.kernel.org/all/f5ad7210-05e0-3dc4-02df-01ce5346e198@xxxxxxxxxx -- Jan Kara <jack@xxxxxxxx> SUSE Labs, CR