summaryrefslogtreecommitdiffstats
path: root/mm/hugetlb.c
diff options
context:
space:
mode:
authorHui Su <sh_def@163.com>2020-12-15 04:11:55 +0100
committerLinus Torvalds <torvalds@linux-foundation.org>2020-12-15 21:13:44 +0100
commite5dfacebe4a47fc9e4dd25246ed3599d60122e38 (patch)
treefd3289689d4a705e7ed5b9d36c5dab1f620e9f73 /mm/hugetlb.c
parentmm,hwpoison: return -EBUSY when migration fails (diff)
downloadlinux-e5dfacebe4a47fc9e4dd25246ed3599d60122e38.tar.xz
linux-e5dfacebe4a47fc9e4dd25246ed3599d60122e38.zip
mm/hugetlb.c: just use put_page_testzero() instead of page_count()
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(). Link: https://lkml.kernel.org/r/20201007170949.GA6416@rlk Signed-off-by: Hui Su <sh_def@163.com> Cc: Mike Kravetz <mike.kravetz@oracle.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to '')
-rw-r--r--mm/hugetlb.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/mm/hugetlb.c b/mm/hugetlb.c
index 4b809cc7a3fd..987d4b57ab0d 100644
--- a/mm/hugetlb.c
+++ b/mm/hugetlb.c
@@ -2014,8 +2014,7 @@ retry:
* 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: