Re: [v2 PATCH] mm: shmem: allow split THP when truncating THP partially

From: Hugh Dickins
Date: Wed Feb 26 2020 - 20:48:02 EST


On Wed, 26 Feb 2020, Matthew Wilcox wrote:
> On Wed, Feb 26, 2020 at 09:43:53AM -0800, Yang Shi wrote:
> > > No. The pagevec_lookup_entries() calls from mm/truncate.c prefer the
> > > new behavior - evicting the head from page cache removes all the tails
> > > along with it, so getting the tails a waste of time there too, just as
> > > it was in shmem_undo_range().
> >
> > TBH I'm not a fun of this hack. This would bring in other confusion or
> > complexity. Pagevec is supposed to count in the number of base page, now it
> > would treat THP as one page, and there might be mixed base page and THP in
> > one pagevec. But, I tend to agree avoiding getting those 14 extra pins at
> > the first place might be a better approach. All the complexity are used to
> > release those extra pins.
>
> My long-term goal is to eradicate tail pages entirely, so a pagevec will
> end up containing pages of different sizes. If you want to help move
> in this direction, I'd be awfully grateful. But I wouldn't say that's
> in any way a prerequisite for fixing this current problem.

You're right to be moving in that direction, but yes, that is a larger
task, and I think both Yang and I have to decline your awful gratitude :)

Hugh