Re: [RFC PATCH] mm: record context on page->mapping

From: Zhaoyang Huang
Date: Thu Feb 10 2022 - 05:01:34 EST


There are some places to modify as 'free_pages_check' for the formal
version, just RFC here to see if it is doable?

On Thu, Feb 10, 2022 at 5:02 PM Huangzhaoyang <huangzhaoyang@xxxxxxxxx> wrote:
>
> From: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx>
>
> Since page->mapping is vacant in the pages which used by kernel(drivers etc)
> Have it record current context to help tracking the page's owner in system
> memory dump.
>
> Signed-off-by: Zhaoyang Huang <zhaoyang.huang@xxxxxxxxxx>
> ---
> mm/page_alloc.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> index c595274..2757d10 100644
> --- a/mm/page_alloc.c
> +++ b/mm/page_alloc.c
> @@ -2430,6 +2430,8 @@ static void prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags
> set_page_pfmemalloc(page);
> else
> clear_page_pfmemalloc(page);
> +
> + page->mapping = (struct address_space *)current;
> }
>
> /*
> --
> 1.9.1
>