提交 9975c8ea 编写于 作者: Z zhong jiang 提交者: Xie XiuQi

mm/hugetlb: release lock before put_page to avoid deadlock

euler inclusion
commit NA
category: bugfix
bugzilla: NA
CVE: NA

------------------------------------------------

Commit 9980d744 ("mm, hugetlb: get rid of surplus page accounting tricks")
introduce the deadloop issue. We hold the hugetlb_lock to deal with
put_page, And if the refcount drop to zero, we will call free_huge_page
to free the page to buddy system. Unfortunatlly, it also need to get the
lock the operation.

The patch just release the lock before put_page. hence it will avoid the
deadloop.

Fixes: 9980d744 ("mm, hugetlb: get rid of surplus page accounting tricks")
Signed-off-by: Nzhong jiang <zhongjiang@huawei.com>
Reviewed-by: NJing Xiangfeng <jingxiangfeng@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 b930bf68
...@@ -1572,8 +1572,9 @@ static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask, ...@@ -1572,8 +1572,9 @@ static struct page *alloc_surplus_huge_page(struct hstate *h, gfp_t gfp_mask,
*/ */
if (h->surplus_huge_pages >= h->nr_overcommit_huge_pages) { if (h->surplus_huge_pages >= h->nr_overcommit_huge_pages) {
SetPageHugeTemporary(page); SetPageHugeTemporary(page);
spin_unlock(&hugetlb_lock);
put_page(page); put_page(page);
page = NULL; return NULL;
} else { } else {
h->surplus_huge_pages++; h->surplus_huge_pages++;
h->surplus_huge_pages_node[page_to_nid(page)]++; h->surplus_huge_pages_node[page_to_nid(page)]++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册