All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH] mm: record context on page->mapping
@ 2022-02-10  9:01 Huangzhaoyang
  2022-02-10 10:00 ` Zhaoyang Huang
  2022-02-10 13:18 ` Matthew Wilcox
  0 siblings, 2 replies; 3+ messages in thread
From: Huangzhaoyang @ 2022-02-10  9:01 UTC (permalink / raw)
  To: Andrew Morton, Zhaoyang Huang, linux-mm, linux-kernel

From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>

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@unisoc.com>
---
 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] mm: record context on page->mapping
  2022-02-10  9:01 [RFC PATCH] mm: record context on page->mapping Huangzhaoyang
@ 2022-02-10 10:00 ` Zhaoyang Huang
  2022-02-10 13:18 ` Matthew Wilcox
  1 sibling, 0 replies; 3+ messages in thread
From: Zhaoyang Huang @ 2022-02-10 10:00 UTC (permalink / raw)
  To: Andrew Morton, Zhaoyang Huang, open list:MEMORY MANAGEMENT, LKML

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@gmail.com> wrote:
>
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
>
> 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@unisoc.com>
> ---
>  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
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [RFC PATCH] mm: record context on page->mapping
  2022-02-10  9:01 [RFC PATCH] mm: record context on page->mapping Huangzhaoyang
  2022-02-10 10:00 ` Zhaoyang Huang
@ 2022-02-10 13:18 ` Matthew Wilcox
  1 sibling, 0 replies; 3+ messages in thread
From: Matthew Wilcox @ 2022-02-10 13:18 UTC (permalink / raw)
  To: Huangzhaoyang; +Cc: Andrew Morton, Zhaoyang Huang, linux-mm, linux-kernel

On Thu, Feb 10, 2022 at 05:01:55PM +0800, Huangzhaoyang wrote:
> From: Zhaoyang Huang <zhaoyang.huang@unisoc.com>
> 
> 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@unisoc.com>
> ---
>  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;
>  }

You didn't actually try this patch, did you?  See page_expected_state().
Or, I don't know, just boot it.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-02-10 13:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-10  9:01 [RFC PATCH] mm: record context on page->mapping Huangzhaoyang
2022-02-10 10:00 ` Zhaoyang Huang
2022-02-10 13:18 ` Matthew Wilcox

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.