Re: [PATCH 7/8] vrange: Add method to purge volatile ranges

From: Minchan Kim
Date: Wed Jun 19 2013 - 00:34:23 EST


On Tue, Jun 11, 2013 at 09:22:50PM -0700, John Stultz wrote:
> From: Minchan Kim <minchan@xxxxxxxxxx>
>
> This patch adds discarding function to purge volatile ranges under
> memory pressure. Logic is as following:
>
> 1. Memory pressure happens
> 2. VM start to reclaim pages
> 3. Check the page is in volatile range.
> 4. If so, zap the page from the process's page table.
> (By semantic vrange(2), we should mark it with another one to
> make page fault when you try to access the address. It will
> be introduced later patch)
> 5. If page is unmapped from all processes, discard it instead of swapping.
>
> This patch does not address the case where there is no swap, which
> keeps anonymous pages from being aged off the LRUs. Minchan has
> additional patches that add support for purging anonymous pages
>
> XXX: First pass at file purging. Seems to work, but is likely broken
> and needs close review.
>
> Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>
> Cc: Android Kernel Team <kernel-team@xxxxxxxxxxx>
> Cc: Robert Love <rlove@xxxxxxxxxx>
> Cc: Mel Gorman <mel@xxxxxxxxx>
> Cc: Hugh Dickins <hughd@xxxxxxxxxx>
> Cc: Dave Hansen <dave@xxxxxxxxxxxxxxxxxx>
> Cc: Rik van Riel <riel@xxxxxxxxxx>
> Cc: Dmitry Adamushko <dmitry.adamushko@xxxxxxxxx>
> Cc: Dave Chinner <david@xxxxxxxxxxxxx>
> Cc: Neil Brown <neilb@xxxxxxx>
> Cc: Andrea Righi <andrea@xxxxxxxxxxxxxxx>
> Cc: Andrea Arcangeli <aarcange@xxxxxxxxxx>
> Cc: Aneesh Kumar K.V <aneesh.kumar@xxxxxxxxxxxxxxxxxx>
> Cc: Mike Hommey <mh@xxxxxxxxxxxx>
> Cc: Taras Glek <tglek@xxxxxxxxxxx>
> Cc: Dhaval Giani <dgiani@xxxxxxxxxxx>
> Cc: Jan Kara <jack@xxxxxxx>
> Cc: KOSAKI Motohiro <kosaki.motohiro@xxxxxxxxx>
> Cc: Michel Lespinasse <walken@xxxxxxxxxx>
> Cc: Minchan Kim <minchan@xxxxxxxxxx>
> Cc: linux-mm@xxxxxxxxx <linux-mm@xxxxxxxxx>
> Signed-off-by: Minchan Kim <minchan@xxxxxxxxxx>
> [jstultz: Reworked to add purging of file pages, commit log tweaks]
> Signed-off-by: John Stultz <john.stultz@xxxxxxxxxx>
> ---
> include/linux/rmap.h | 12 +-
> include/linux/swap.h | 1 +
> include/linux/vrange.h | 7 ++
> mm/ksm.c | 2 +-
> mm/rmap.c | 30 +++--
> mm/swapfile.c | 36 ++++++
> mm/vmscan.c | 16 ++-
> mm/vrange.c | 332 +++++++++++++++++++++++++++++++++++++++++++++++++
> 8 files changed, 420 insertions(+), 16 deletions(-)

This patch has some bugs so below patch should fix them and pass my
simple cases.