The patch titled Subject: mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge-v3 has been added to the -mm tree. Its filename is mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge-v3.patch This patch should soon appear at http://ozlabs.org/~akpm/mmots/broken-out/mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge-v3.patch and later at http://ozlabs.org/~akpm/mmotm/broken-out/mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge-v3.patch Before you just go and hit "reply", please: a) Consider who else should be cc'ed b) Prefer to cc a suitable mailing list as well c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's *** Remember to use Documentation/process/submit-checklist.rst when testing your code *** The -mm tree is included into linux-next and is updated there every 3-4 working days ------------------------------------------------------ From: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Subject: mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge-v3 - add PageHuge check in dissolve_free_huge_page() outside hugetlb_lock - update comment on dissolve_free_huge_page() about return value Link: http://lkml.kernel.org/r/1560761476-4651-3-git-send-email-n-horiguchi@xxxxxxxxxxxxx Reported-by: Chen, Jerry T <jerry.t.chen@xxxxxxxxx> Tested-by: Chen, Jerry T <jerry.t.chen@xxxxxxxxx> Signed-off-by: Naoya Horiguchi <n-horiguchi@xxxxxxxxxxxxx> Fixes: 6bc9b56433b76 ("mm: fix race on soft-offlining") Cc: Michal Hocko <mhocko@xxxxxxxxxx> Cc: Mike Kravetz <mike.kravetz@xxxxxxxxxx> Cc: Xishi Qiu <xishi.qiuxishi@xxxxxxxxxxxxxxx> Cc: "Chen, Jerry T" <jerry.t.chen@xxxxxxxxx> Cc: "Zhuo, Qiuxu" <qiuxu.zhuo@xxxxxxxxx> Cc: <stable@xxxxxxxxxxxxxxx> [4.19+] Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- mm/hugetlb.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/mm/hugetlb.c~mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge-v3 +++ a/mm/hugetlb.c @@ -1510,14 +1510,22 @@ static int free_pool_huge_page(struct hs /* * Dissolve a given free hugepage into free buddy pages. This function does - * nothing for in-use (including surplus) hugepages. Returns -EBUSY if the - * dissolution fails because a give page is not a free hugepage, or because - * free hugepages are fully reserved. + * nothing for in-use hugepages and non-hugepages. + * This function returns values like below: + * + * -EBUSY: failed to dissolved free hugepages or the hugepage is in-use + * (allocated or reserved.) + * 0: successfully dissolved free hugepages or the page is not a + * hugepage (considered as already dissolved) */ int dissolve_free_huge_page(struct page *page) { int rc = -EBUSY; + /* Not to disrupt normal path by vainly holding hugetlb_lock */ + if (!PageHuge(page)) + return 0; + spin_lock(&hugetlb_lock); if (!PageHuge(page)) { rc = 0; _ Patches currently in -mm which might be from n-horiguchi@xxxxxxxxxxxxx are mm-soft-offline-return-ebusy-if-set_hwpoison_free_buddy_page-fails.patch mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge.patch mm-hugetlb-soft-offline-dissolve_free_huge_page-return-zero-on-pagehuge-v3.patch