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

From: Matthew Wilcox
Date: Wed Feb 26 2020 - 20:17:03 EST


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.