All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] hugetlbfs: Call VM_BUG_ON_PAGE earlier in free_huge_page
@ 2018-11-29 11:44 Yongkai Wu
  2018-11-29 13:51 ` William Kucharski
  0 siblings, 1 reply; 3+ messages in thread
From: Yongkai Wu @ 2018-11-29 11:44 UTC (permalink / raw)
  To: mike.kravetz; +Cc: linux-mm, linux-kernel, nic_w

A stack trace was triggered by VM_BUG_ON_PAGE(page_mapcount(page),
page) in free_huge_page().  Unfortunately, the page->mapping field
was set to NULL before this test.  This made it more difficult to
determine the root cause of the problem.

Move the VM_BUG_ON_PAGE tests earlier in the function so that if
they do trigger more information is present in the page struct.

Signed-off-by: Yongkai Wu <nic_w@163.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
---
 mm/hugetlb.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 7f2a28a..14ef274 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;
 
-	set_page_private(page, 0);
-	page->mapping = NULL;
 	VM_BUG_ON_PAGE(page_count(page), page);
 	VM_BUG_ON_PAGE(page_mapcount(page), page);
+
+	set_page_private(page, 0);
+	page->mapping = NULL;
 	restore_reserve = PagePrivate(page);
 	ClearPagePrivate(page);
 
-- 
1.8.3.1


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

* Re: [PATCH] hugetlbfs: Call VM_BUG_ON_PAGE earlier in free_huge_page
  2018-11-29 11:44 [PATCH] hugetlbfs: Call VM_BUG_ON_PAGE earlier in free_huge_page Yongkai Wu
@ 2018-11-29 13:51 ` William Kucharski
  2018-11-29 20:52   ` Mike Kravetz
  0 siblings, 1 reply; 3+ messages in thread
From: William Kucharski @ 2018-11-29 13:51 UTC (permalink / raw)
  To: Yongkai Wu; +Cc: mike.kravetz, linux-mm, linux-kernel, nic_w

Reviewed-by: William Kucharski <william.kucharski@oracle.com>

> On Nov 29, 2018, at 4:44 AM, Yongkai Wu <nic.wuyk@gmail.com> wrote:
> 
> A stack trace was triggered by VM_BUG_ON_PAGE(page_mapcount(page),
> page) in free_huge_page().  Unfortunately, the page->mapping field
> was set to NULL before this test.  This made it more difficult to
> determine the root cause of the problem.
> 
> Move the VM_BUG_ON_PAGE tests earlier in the function so that if
> they do trigger more information is present in the page struct.
> 
> Signed-off-by: Yongkai Wu <nic_w@163.com>
> Acked-by: Michal Hocko <mhocko@suse.com>
> Acked-by: Mike Kravetz <mike.kravetz@oracle.com>
> ---
> mm/hugetlb.c | 5 +++--
> 1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
> index 7f2a28a..14ef274 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;
> 
> -	set_page_private(page, 0);
> -	page->mapping = NULL;
> 	VM_BUG_ON_PAGE(page_count(page), page);
> 	VM_BUG_ON_PAGE(page_mapcount(page), page);
> +
> +	set_page_private(page, 0);
> +	page->mapping = NULL;
> 	restore_reserve = PagePrivate(page);
> 	ClearPagePrivate(page);
> 
> -- 
> 1.8.3.1
> 


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

* Re: [PATCH] hugetlbfs: Call VM_BUG_ON_PAGE earlier in free_huge_page
  2018-11-29 13:51 ` William Kucharski
@ 2018-11-29 20:52   ` Mike Kravetz
  0 siblings, 0 replies; 3+ messages in thread
From: Mike Kravetz @ 2018-11-29 20:52 UTC (permalink / raw)
  To: William Kucharski, Yongkai Wu, Andrew Morton
  Cc: linux-mm, linux-kernel, nic_w, Michal Hocko

On 11/29/18 5:51 AM, William Kucharski wrote:
> Reviewed-by: William Kucharski <william.kucharski@oracle.com>
> 
>> On Nov 29, 2018, at 4:44 AM, Yongkai Wu <nic.wuyk@gmail.com> wrote:
>>
>> A stack trace was triggered by VM_BUG_ON_PAGE(page_mapcount(page),
>> page) in free_huge_page().  Unfortunately, the page->mapping field
>> was set to NULL before this test.  This made it more difficult to
>> determine the root cause of the problem.
>>
>> Move the VM_BUG_ON_PAGE tests earlier in the function so that if
>> they do trigger more information is present in the page struct.
>>
>> Signed-off-by: Yongkai Wu <nic_w@163.com>
>> Acked-by: Michal Hocko <mhocko@suse.com>
>> Acked-by: Mike Kravetz <mike.kravetz@oracle.com>

Thank you for fixing the formatting and commit message.

Adding Andrew on so he can add to his tree as appropriatre. Also Cc'ing Michal.

>> ---
>> mm/hugetlb.c | 5 +++--
>> 1 file changed, 3 insertions(+), 2 deletions(-)
>>
>> diff --git a/mm/hugetlb.c b/mm/hugetlb.c
>> index 7f2a28a..14ef274 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;
>>
>> -	set_page_private(page, 0);
>> -	page->mapping = NULL;
>> 	VM_BUG_ON_PAGE(page_count(page), page);
>> 	VM_BUG_ON_PAGE(page_mapcount(page), page);
>> +
>> +	set_page_private(page, 0);
>> +	page->mapping = NULL;
>> 	restore_reserve = PagePrivate(page);
>> 	ClearPagePrivate(page);
>>
>> -- 
>> 1.8.3.1
>>
> 


-- 
Mike Kravetz

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

end of thread, other threads:[~2018-11-29 20:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-29 11:44 [PATCH] hugetlbfs: Call VM_BUG_ON_PAGE earlier in free_huge_page Yongkai Wu
2018-11-29 13:51 ` William Kucharski
2018-11-29 20:52   ` Mike Kravetz

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.