From db1d159bacd4156b965d8158bc32dfde29353c52 Mon Sep 17 00:00:00 2001 From: Weilong Chen Date: Tue, 22 Sep 2020 10:23:39 +0800 Subject: [PATCH] arm64/ascend: Add hugepage flags change interface 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 Reviewed-by: Ding Tianhong Signed-off-by: Yang Yingliang --- mm/hugetlb.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index aa91f0f33b8e..82e9bd7dfb7e 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, -- GitLab