Commit c3aad494 authored by Liu Shixin's avatar Liu Shixin Committed by Zheng Zengkai
Browse files

mm/dynamic_hugetlb: check page using check_new_page

hulk inclusion
category: bugfix
bugzilla: 46904 https://gitee.com/openeuler/kernel/issues/I4Y0XO



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

Use check_new_page to check the page to be allocated.

Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
Reviewed-by: default avatarKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent d0c9c735
Loading
Loading
Loading
Loading
+16 −13
Original line number Diff line number Diff line
@@ -476,6 +476,8 @@ static struct page *__alloc_page_from_dhugetlb_pool(void)
	 */
	spin_lock_irqsave(&percpu_pool->lock, flags);

	do {
		page = NULL;
		if (percpu_pool->free_pages == 0) {
			int ret;

@@ -490,6 +492,7 @@ 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--;
	} while (page && check_new_page(page));
	percpu_pool->used_pages++;
	SetPagePool(page);

+1 −0
Original line number Diff line number Diff line
@@ -195,6 +195,7 @@ extern void memblock_free_pages(struct page *page, unsigned long pfn,
					unsigned int order);
extern void __free_pages_core(struct page *page, unsigned int order);
extern void prep_compound_page(struct page *page, unsigned int order);
extern int check_new_page(struct page *page);
extern void post_alloc_hook(struct page *page, unsigned int order,
					gfp_t gfp_flags);
extern void prep_new_page(struct page *page, unsigned int order, gfp_t gfp_flags,
+1 −1
Original line number Diff line number Diff line
@@ -2204,7 +2204,7 @@ static void check_new_page_bad(struct page *page)
/*
 * This page is about to be returned from the page allocator
 */
static inline int check_new_page(struct page *page)
inline int check_new_page(struct page *page)
{
	if (likely(page_expected_state(page,
				PAGE_FLAGS_CHECK_AT_PREP|__PG_HWPOISON)))