提交 3a6c3c88 编写于 作者: L Liu Shixin

mm/dynamic_hugetlb: set PagePool to bad page

hulk inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I6XOIE
CVE: NA

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

Before discard the bad page, set PagePool flag to distinguish from free
page. And increase used_pages to guarantee used + freed = total.
Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
上级 34f286be
......@@ -529,6 +529,13 @@ static struct page *__alloc_page_from_dhugetlb_pool(void)
spin_lock_irqsave(&percpu_pool->lock, flags);
do {
/*
* Before discard the bad page, set PagePool flag to
* distinguish from free page. And increase used_pages
* to guarantee used + freed = total.
*/
if (page)
SetPagePool(page);
page = NULL;
if (percpu_pool->free_pages == 0) {
int ret;
......@@ -544,8 +551,8 @@ static struct page *__alloc_page_from_dhugetlb_pool(void)
page = list_entry(percpu_pool->head_page.next, struct page, lru);
list_del(&page->lru);
percpu_pool->free_pages--;
percpu_pool->used_pages++;
} while (page && check_new_page(page));
percpu_pool->used_pages++;
SetPagePool(page);
unlock:
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册