From: Shaohua Li Date: Wed, 3 May 2017 21:52:39 +0000 (-0700) Subject: mm: enable MADV_FREE for swapless system X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=93e06c7a645343d222c9a838834a51042eebbbf7;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git mm: enable MADV_FREE for swapless system Now MADV_FREE pages can be easily reclaimed even for swapless system. We can safely enable MADV_FREE for all systems. Link: http://lkml.kernel.org/r/155648585589300bfae1d45078e7aebb3d988b87.1487965799.git.shli@fb.com Signed-off-by: Shaohua Li Acked-by: Johannes Weiner Acked-by: Michal Hocko Acked-by: Hillf Danton Acked-by: Minchan Kim Cc: Hugh Dickins Cc: Rik van Riel Cc: Mel Gorman Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- diff --git a/mm/madvise.c b/mm/madvise.c index d3a6712c3e14..a09d2d3dfae9 100644 --- a/mm/madvise.c +++ b/mm/madvise.c @@ -650,13 +650,7 @@ madvise_vma(struct vm_area_struct *vma, struct vm_area_struct **prev, case MADV_WILLNEED: return madvise_willneed(vma, prev, start, end); case MADV_FREE: - /* - * XXX: In this implementation, MADV_FREE works like - * MADV_DONTNEED on swapless system or full swap. - */ - if (get_nr_swap_pages() > 0) - return madvise_free(vma, prev, start, end); - /* passthrough */ + return madvise_free(vma, prev, start, end); case MADV_DONTNEED: return madvise_dontneed(vma, prev, start, end); default: