linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Yongkai Wu <nic.wuyk@gmail.com>
To: mike.kravetz@oracle.com
Cc: linux-mm@kvack.org, linux-kernel@vger.kernel.org, nic_w@163.com
Subject: [PATCH] hugetlbfs: Call VM_BUG_ON_PAGE earlier in free_huge_page
Date: Thu, 29 Nov 2018 19:44:03 +0800	[thread overview]
Message-ID: <1543491843-23438-1-git-send-email-nic_w@163.com> (raw)

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

             reply	other threads:[~2018-11-29 11:44 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-29 11:44 Yongkai Wu [this message]
2018-11-29 13:51 ` William Kucharski
2018-11-29 20:52   ` Mike Kravetz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1543491843-23438-1-git-send-email-nic_w@163.com \
    --to=nic.wuyk@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.com \
    --cc=nic_w@163.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox