On Thu, 2017-09-21 at 13:27 -0700, Shaohua Li wrote: > From: Shaohua Li <shli@xxxxxx> > > MADV_FREE clears pte dirty bit and then marks the page lazyfree > (clear > SwapBacked). There is no lock to prevent the page is added to swap > cache > between these two steps by page reclaim. If the page is added to swap > cache, marking the page lazyfree will confuse page fault if the page > is > reclaimed and refault. > > Reported-and-tested-y: Artem Savkov <asavkov@xxxxxxxxxx> > Fix: 802a3a92ad7a(mm: reclaim MADV_FREE pages) > Signed-off-by: Shaohua Li <shli@xxxxxx> > Cc: stable@xxxxxxxxxxxxxxx > Cc: Johannes Weiner <hannes@xxxxxxxxxxx> > Cc: Michal Hocko <mhocko@xxxxxxxx> > Cc: Hillf Danton <hillf.zj@xxxxxxxxxxxxxxx> > Cc: Minchan Kim <minchan@xxxxxxxxxx> > Cc: Hugh Dickins <hughd@xxxxxxxxxx> > Cc: Rik van Riel <riel@xxxxxxxxxx> > Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx> > Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> > Reviewed-by: Rik van Riel <riel@xxxxxxxxxx>