From: Weilong Chen chenweilong@huawei.com
ascend inclusion category: feature bugzilla: NA CVE: NA
-------------------------------------------------
Add a variable to change alloc hugepage gfp flags, and export it out. Hugepage need to be accounted by cgroup. We use this to set ACCOUNT flag to memory subsystem.
Signed-off-by: Weilong Chen chenweilong@huawei.com Reviewed-by: Ding Tianhong dingtianhong@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- mm/hugetlb.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index cabf889d296b..5356f7e5daf2 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -1471,6 +1471,10 @@ static struct page *alloc_fresh_huge_page(struct hstate *h, return page; }
+#ifdef CONFIG_ASCEND_AUTO_TUNING_HUGEPAGE +gfp_t hugepage_gfp_mask = 0; +EXPORT_SYMBOL(hugepage_gfp_mask); +#endif /* * Allocates a fresh page to the hugetlb allocator pool in the node interleaved * manner. @@ -1480,7 +1484,12 @@ static int alloc_pool_huge_page(struct hstate *h, nodemask_t *nodes_allowed, { struct page *page; int nr_nodes, node; +#ifdef CONFIG_ASCEND_AUTO_TUNING_HUGEPAGE + gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE | + hugepage_gfp_mask; +#else gfp_t gfp_mask = htlb_alloc_mask(h) | __GFP_THISNODE; +#endif
for_each_node_mask_to_alloc(h, nr_nodes, node, nodes_allowed) { page = alloc_fresh_huge_page(h, gfp_mask, node, nodes_allowed,