public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Hui Su <sh_def@163.com>
To: mike.kravetz@oracle.com, akpm@linux-foundation.org,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org
Subject: [PATCH] mm/hugetlb.c: just use put_page_testzero() instead of page_count()
Date: Thu, 8 Oct 2020 01:09:49 +0800	[thread overview]
Message-ID: <20201007170949.GA6416@rlk> (raw)

we test the page reference count is zero or not here,
it can be a bug here if page refercence count is not zero.
So we can just use put_page_testzero() instead of
page_count().

Signed-off-by: Hui Su <sh_def@163.com>
---
 mm/hugetlb.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 67fc6383995b..a274b9ac466f 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2105,8 +2105,7 @@ static int gather_surplus_pages(struct hstate *h, int delta)
 		 * This page is now managed by the hugetlb allocator and has
 		 * no users -- drop the buddy allocator's reference.
 		 */
-		put_page_testzero(page);
-		VM_BUG_ON_PAGE(page_count(page), page);
+		VM_BUG_ON_PAGE(!put_page_testzero(page), page);
 		enqueue_huge_page(h, page);
 	}
 free:
-- 
2.25.1



                 reply	other threads:[~2020-10-07 17:11 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20201007170949.GA6416@rlk \
    --to=sh_def@163.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mike.kravetz@oracle.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