Re: [PATCH V2 2/7] mm: move MADV_FREE pages into LRU_INACTIVE_FILE list
From: Shaohua Li
Date: Fri Feb 10 2017 - 14:06:39 EST
On Fri, Feb 10, 2017 at 02:02:36PM +0100, Michal Hocko wrote:
> On Fri 03-02-17 15:33:18, Shaohua Li wrote:
> > Userspace indicates MADV_FREE pages could be freed without pageout, so
> > it pretty much likes used once file pages. For such pages, we'd like to
> > reclaim them once there is memory pressure. Also it might be unfair
> > reclaiming MADV_FREE pages always before used once file pages and we
> > definitively want to reclaim the pages before other anonymous and file
> > pages.
> > To speed up MADV_FREE pages reclaim, we put the pages into
> > LRU_INACTIVE_FILE list. The rationale is LRU_INACTIVE_FILE list is tiny
> > nowadays and should be full of used once file pages. Reclaiming
> > MADV_FREE pages will not have much interfere of anonymous and active
> > file pages. And the inactive file pages and MADV_FREE pages will be
> > reclaimed according to their age, so we don't reclaim too many MADV_FREE
> > pages too. Putting the MADV_FREE pages into LRU_INACTIVE_FILE_LIST also
> > means we can reclaim the pages without swap support. This idea is
> > suggested by Johannes.
> > We also clear the pages SwapBacked flag to indicate they are MADV_FREE
> > pages.
> I like this. I have expected this to be more convoluted but it looks
> quite straightforward. I didn't get to do a really deep review and add
> my acked-by but from a quick look there do not seem to be any surprises.
> I was worried about vmstat accounting. There are some places which
> isolate page from LRU and account based on the LRU and later use
> page_is_file_cache to tell which LRU this was. This should work fine,
> though, because you never touch pages which are off-lru.
> That being said I do not see any major issues. There might be some minor
> things and this will need a lot of testing but it is definitely a move
> into right direction. I hope to do the deeper review after I get back
> from vacation (20th Feb).
Sweat! Thanks for your time!
> > Cc: Michal Hocko <mhocko@xxxxxxxx>
> > Cc: Minchan Kim <minchan@xxxxxxxxxx>
> > Cc: Hugh Dickins <hughd@xxxxxxxxxx>
> > Cc: Johannes Weiner <hannes@xxxxxxxxxxx>
> > Cc: Rik van Riel <riel@xxxxxxxxxx>
> > Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
> > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> I guess
> Suggested-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> would be appropriate.
Sure, will add in next post and will add 'the patches are based on Minchan's