On 2/14/23 05:06, Jan Kara wrote: > On Mon 13-02-23 01:55:04, Christoph Hellwig wrote: >> I think we need to distinguish between short- and long terms pins. >> For short term pins like direct I/O it doesn't make sense to take them >> off the lru, or to do any other special action. Writeback will simplify >> have to wait for the short term pin. >> >> Long-term pins absolutely would make sense to be taken off the LRU list. > > Yeah, I agree distinguishing these two would be nice as we could treat them > differently then. The trouble is a bit with always-crowded struct page. But > now it occurred to me that if we are going to take these long-term pinned > pages out from the LRU, we could overload the space for LRU pointers with > the counter (which is what I think John originally did). So yes, possibly > we could track separately long-term and short-term pins. John, what do you > think? Maybe time to revive your patches from 2018 in a bit different form? > ;) > Oh wow, I really love this idea. We kept running into problems because long- and short-term pins were mixed up together (except during creation), and this, at long last, separates them. Very nice. I'd almost forgotten about the 2018 page.lru adventures, too. ha :) One objection might be that pinning is now going to be taking a lot of space in struct page / folio, but I think it's warranted, based on the long-standing, difficult problems that it would solve. We could even leave most of these patches, and David Howells' patches, intact, by using an approach similar to the mm_users and mm_count technique: maintain a long-term pin count in one of the folio->lru fields, and any non-zero count there creates a single count in folio->_pincount. I could put together something to do that. thanks, -- John Hubbard NVIDIA