Re: [PATCH] mm/hugetl.c: keep the page mapping info when free_huge_page() hit the VM_BUG_ON_PAGE
From: Michal Hocko
Date: Tue Nov 13 2018 - 08:04:38 EST
On Tue 13-11-18 20:38:16, Yongkai Wu wrote:
> It is better to keep page mapping info when free_huge_page() hit the
> VM_BUG_ON_PAGE,
> so we can get more infomation from the coredump for further analysis.
The patch seems to be whitespace damaged. Put that aside, have you
actually seen a case where preservning the page state would help to nail
down any bug.
I am not objecting to the patch, it actually makes some sense to me, I
am just curious about a background motivation.
> Signed-off-by: Yongkai Wu <nic_w@xxxxxxx>
> ---
> mm/hugetlb.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index c007fb5..ba693bb 100644
> --- a/mm/hugetlb.c
> +++ b/mm/hugetlb.c
> @@ -1248,10 +1248,11 @@ void free_huge_page(struct page *page)
> (struct hugepage_subpool *)page_private(page);
> bool restore_reserve;
>
> + VM_BUG_ON_PAGE(page_count(page), page);
> + VM_BUG_ON_PAGE(page_mapcount(page), page);
> +
> set_page_private(page, 0);
> page->mapping = NULL;
> - VM_BUG_ON_PAGE(page_count(page), page);
> - VM_BUG_ON_PAGE(page_mapcount(page), page);
> restore_reserve = PagePrivate(page);
> ClearPagePrivate(page);
>
> --
> 1.8.3.1
--
Michal Hocko
SUSE Labs