Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Hui Su and committed by
Linus Torvalds
e5dfaceb 3f4b815a

+1 -2
+1 -2
mm/hugetlb.c
··· 2014 2014 * This page is now managed by the hugetlb allocator and has 2015 2015 * no users -- drop the buddy allocator's reference. 2016 2016 */ 2017 - put_page_testzero(page); 2018 - VM_BUG_ON_PAGE(page_count(page), page); 2017 + VM_BUG_ON_PAGE(!put_page_testzero(page), page); 2019 2018 enqueue_huge_page(h, page); 2020 2019 } 2021 2020 free: