Re: [PATCH 4/4] vfs: keep inodes with page cache off the inode shrinker LRU

From: Andrew Morton
Date: Wed Jun 16 2021 - 21:30:48 EST


On Wed, 16 Jun 2021 00:54:15 -0400 Johannes Weiner <hannes@xxxxxxxxxxx> wrote:

> On Wed, Jun 16, 2021 at 11:20:08AM +1000, Dave Chinner wrote:
> > On Tue, Jun 15, 2021 at 02:50:09PM -0400, Johannes Weiner wrote:
> > > On Tue, Jun 15, 2021 at 04:26:40PM +1000, Dave Chinner wrote:
> > > > On Mon, Jun 14, 2021 at 05:19:04PM -0400, Johannes Weiner wrote:
> > > > > @@ -1123,6 +1125,9 @@ static int __remove_mapping(struct address_space *mapping, struct page *page,
> > > > > shadow = workingset_eviction(page, target_memcg);
> > > > > __delete_from_page_cache(page, shadow);
> > > > > xa_unlock_irq(&mapping->i_pages);
> > > > > + if (mapping_shrinkable(mapping))
> > > > > + inode_add_lru(mapping->host);
> > > > > + spin_unlock(&mapping->host->i_lock);
> > > > >
> > > >
> > > > No. Inode locks have absolutely no place serialising core vmscan
> > > > algorithms.
> > >
> > > What if, and hear me out on this one, core vmscan algorithms change
> > > the state of the inode?
> >
> > Then the core vmscan algorithm has a layering violation.
>
> You're just playing a word game here.

Don't think so. David is quite correct in saying that vmscan shouldn't
mess with inode state unless it's via address_space_operations?