From b6bcd500561c908d757caaa39ee719a63cf1ada0 Mon Sep 17 00:00:00 2001 From: Weilong Chen Date: Tue, 22 Sep 2020 10:23:38 +0800 Subject: [PATCH] arm64/ascend: Add set hugepage number helper function ascend inclusion category: feature bugzilla: NA CVE: NA ------------------------------------------------- Add helper function for change system hugepage nr, and export it out. Signed-off-by: Weilong Chen Reviewed-by: Ding Tianhong Signed-off-by: Yang Yingliang --- mm/hugetlb.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 009313824b8c..aa91f0f33b8e 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c @@ -3068,6 +3068,19 @@ int hugetlb_sysctl_handler(struct ctl_table *table, int write, buffer, length, ppos); } +#ifdef CONFIG_ASCEND_AUTO_TUNING_HUGEPAGE +int hugetlb_sysctl_store(size_t length) +{ + int ret; + struct hstate *h = &default_hstate; + + ret = __nr_hugepages_store_common(false, h, NUMA_NO_NODE, length, + length); + return ret; +} +EXPORT_SYMBOL(hugetlb_sysctl_store); +#endif + #ifdef CONFIG_NUMA int hugetlb_mempolicy_sysctl_handler(struct ctl_table *table, int write, void __user *buffer, size_t *length, loff_t *ppos) -- GitLab