Re: [RFC 0/3] mm: Discard lazily freed pages when migrating

From: Huang\, Ying
Date: Mon Mar 09 2020 - 01:27:37 EST


Mel Gorman <mgorman@xxxxxxx> writes:

> I think the only concrete outcome has been that userspace potentially
> benefits if the total number of MADV_FREE pages is reported
> globally. Even that is marginal as smaps has the information to tell
> the difference between high RSS due to a memory leak and high RSS
> usage due to MADV_FREE. The /proc/vmstats for MADV_FREE are of
> marginal benefit given that they do not tell us much about the current
> number of MADV_FREE pages in the system.

We can implement a counter for MADV_FREE that increases when we
ClearPageSwapBacked() and decrease when we SetPageSwapBacked() for an
anonymous page. But this cannot count lazily freed pages correctly.
Because when a clean MDV_FREE page becomes dirty, there's no page fault
so we will not be notified. And you have never run into the MADV_FREE
issues other than the memory leaking debugging...

Best Regards,
Huang, Ying