[PATCH 0/2] mm/madvise: teach MADV_PAGEOUT about swap cache
From: Dave Hansen
Date: Mon Mar 23 2020 - 19:42:57 EST
MADV_PAGEOUT ignores swap cache pages which are not mapped
into the calling process. That's nasty because it means that
some of the most easily reclaimable pages are inaccessible to
a mechanism designed to reclaim pages.
This all turned out to be a bit nastier and more complicated
than I would have liked. This has been lightly tested, but I
did pass a normal barrage of compile tests.
I rigged up a little test program to try to create these
situations. Basically, if the parent "reader" RSS changes
in response to MADV_PAGEOUT actions in the child, there is
a problem.
https://www.sr71.net/~dave/intel/madv-pageout.c
I'd add this to selftests, but it *requires* swap to work
and its parsing of /proc/self/maps is quite icky.
P.S. mincore() really doesn't work at all in this situation,
probably something we need to look at too.
Cc: Michal Hocko <mhocko@xxxxxxxx>
Cc: Jann Horn <jannh@xxxxxxxxxx>
Cc: Vlastimil Babka <vbabka@xxxxxxx>
Cc: Minchan Kim <minchan@xxxxxxxxxx>
Cc: Daniel Colascione <dancol@xxxxxxxxxx>
Cc: "Joel Fernandes (Google)" <joel@xxxxxxxxxxxxxxxxx>
Cc: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx>