]> git.karo-electronics.de Git - karo-tx-linux.git/commit
mm: simplify reclaim path for MADV_FREE
authorMinchan Kim <minchan@kernel.org>
Wed, 21 Oct 2015 22:03:47 +0000 (09:03 +1100)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 21 Oct 2015 22:03:47 +0000 (09:03 +1100)
commit0853efabace7cf700a0ad66209e66089da206e4c
tree037e66a674185858baea50e4ab89dd9a17563873
parentf3820ab6857a65b3be53f1ba301b0e2bcaf12753
mm: simplify reclaim path for MADV_FREE

I made reclaim path mess to check and free MADV_FREEed page.  This patch
simplify it with tweaking add_to_swap.

So far, we mark page as PG_dirty when we add the page into swap cache(ie,
add_to_swap) to page out to swap device but this patch moves PG_dirty
marking under try_to_unmap_one when we decide to change pte from anon to
swapent so if any process's pte has swapent for the page, the page must be
swapped out.  IOW, there should be no funcional behavior change.  It makes
relcaim path really simple for MADV_FREE because we just need to check
PG_dirty of page to decide discarding the page or not.

Other thing this patch does is to pass TTU_BATCH_FLUSH to try_to_unmap
when we handle freeable page because I don't see any reason to prevent it.

Signed-off-by: Minchan Kim <minchan@kernel.org>
Cc: Hugh Dickins <hughd@google.com>
Cc: Mel Gorman <mgorman@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
include/linux/rmap.h
mm/huge_memory.c
mm/rmap.c
mm/swap_state.c
mm/vmscan.c