Re: [PATCH] mm: Code cleanup for MADV_FREE

From: Michal Hocko
Date: Fri Mar 13 2020 - 11:41:18 EST


On Fri 13-03-20 17:00:56, Huang, Ying wrote:
> From: Huang Ying <ying.huang@xxxxxxxxx>
>
> Some comments for MADV_FREE is revised and added to help people understand the
> MADV_FREE code, especially the page flag, PG_swapbacked. This makes
> page_is_file_cache() isn't consistent with its comments. So the function is
> renamed to page_is_file_lru() to make them consistent again. All these are put
> in one patch as one logical change.
>
> Signed-off-by: "Huang, Ying" <ying.huang@xxxxxxxxx>
> Suggested-by: David Hildenbrand <david@xxxxxxxxxx>
> Suggested-by: Johannes Weiner <hannes@xxxxxxxxxxx>
> Suggested-by: David Rientjes <rientjes@xxxxxxxxxx>
> Cc: Michal Hocko <mhocko@xxxxxxxxxx>
> Cc: Dave Hansen <dave.hansen@xxxxxxxxxxxxxxx>
> Cc: Mel Gorman <mgorman@xxxxxxx>
> Cc: Vlastimil Babka <vbabka@xxxxxxx>
> Cc: Minchan Kim <minchan@xxxxxxxxxx>
> Cc: Hugh Dickins <hughd@xxxxxxxxxx>
> Cc: Rik van Riel <riel@xxxxxxxxxxx>

Acked-by: Michal Hocko <mhocko@xxxxxxxx>

Although I would rephrased this a bit
> + * PG_swapbacked is cleared if the page is page cache page backed by a regular
> + * file system or anonymous page lazily freed (e.g. via MADV_FREE). It is set
> + * if the page is normal anonymous page, tmpfs or otherwise RAM or swap backed.
> + *

PG_swapbacked is set when a page uses swap as a backing storage. This
are usually PageAnon or shmem pages but please note that even anonymous
pages might lose their PG_swapbacked flag when they simply can be
dropped (e.g. as a result of MADV_FREE).
--
Michal Hocko
SUSE Labs