From: Jian Zhang zhangjian210@huawei.com
Offering: HULK hulk inclusion category: other bugzilla: https://gitee.com/openeuler/kernel/issues/I7QLRH
----------------------------------------------
When use hugetlb_alloc_hugepage() to alloc static hugepage, the page will be allocated from other node which is different from the node user passed.
Signed-off-by: Jian Zhang zhangjian210@huawei.com Signed-off-by: Wang Wensheng wangwensheng4@huawei.com --- mm/hugetlb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 229b4170d1cd..e144c7657ae2 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -6299,14 +6299,14 @@ const struct hstate *hugetlb_get_hstate(void) EXPORT_SYMBOL_GPL(hugetlb_get_hstate);
static struct page *hugetlb_alloc_hugepage_normal(struct hstate *h, - gfp_t gfp_mask, int nid) + gfp_t gfp_mask, int nid, nodemask_t *nodemask) { unsigned long flags; struct page *page = NULL;
spin_lock_irqsave(&hugetlb_lock, flags); if (h->free_huge_pages - h->resv_huge_pages > 0) - page = dequeue_huge_page_nodemask(h, gfp_mask, nid, NULL, NULL); + page = dequeue_huge_page_nodemask(h, gfp_mask, nid, nodemask, NULL); spin_unlock_irqrestore(&hugetlb_lock, flags);
return page; @@ -6337,7 +6337,7 @@ struct page *hugetlb_alloc_hugepage_nodemask(int nid, int flag, nodemask_t *node gfp_mask &= ~__GFP_RECLAIM;
if (flag & HUGETLB_ALLOC_NORMAL) - page = hugetlb_alloc_hugepage_normal(h, gfp_mask, nid); + page = hugetlb_alloc_hugepage_normal(h, gfp_mask, nid, nodemask); else if (flag & HUGETLB_ALLOC_BUDDY) page = alloc_migrate_huge_page(h, gfp_mask, nid, nodemask); else