On Tue, 17 Dec 2019 11:54:22 -0500 Johannes Weiner <hannes@xxxxxxxxxxx> wrote: > I've carried the below patch in my private tree for testing cache > aging decisions that the shrinker interfered with. (It would be nicer > if page cache pages could pin the inode of course, but reclaim cannot > easily participate in the inode refcounting scheme.) > > ... > > --- a/fs/inode.c > +++ b/fs/inode.c > @@ -753,7 +753,13 @@ static enum lru_status inode_lru_isolate(struct list_head *item, > return LRU_ROTATE; > } > > - if (inode_has_buffers(inode) || inode->i_data.nrpages) { > + /* Leave the pages to page reclaim */ > + if (inode->i_data.nrpages) { > + spin_unlock(&inode->i_lock); > + return LRU_ROTATE; > + } I guess that code should have been commented... This code was originally added because on large highmem machines we were seeing lowmem full of inodes which had one or more highmem pages attached to them. Highmem was not under memory pressure so those pagecache pages remained unreclaimed "for ever", thus pinning their lowmem inode. The net result was exhaustion of lowmem. I guess a #ifdef CONFIG_HIGHMEM would help, to preserve the old behavior in that case. Although given the paucity of testing on large highmem machines, the risk of divergent behavior over time is a concern.