From: Ding Tianhong dingtianhong@huawei.com
ascend inclusion category: feature bugzilla: NA CVE: NA
-------------------------------------------------
The proc_share_init should be used in proc_root_init when enable the share pool features.
The is_vm_huge_special() was used to distinguish the vma with VM_HUGE_SPECIAL and handle it, it would not be used by default.
Signed-off-by: Tang Yizhou tangyizhou@huawei.com Signed-off-by: Li Ming limingming.li@huawei.com Signed-off-by: Zefan Li lizefan@huawei.com Signed-off-by: Zhou Guanghui zhouguanghui1@huawei.com Signed-off-by: Ding Tianhong dingtianhong@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: Yang Yingliang yangyingliang@huawei.com --- fs/proc/root.c | 2 ++ mm/pagewalk.c | 5 +++-- 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/fs/proc/root.c b/fs/proc/root.c index f4b1a9d2eca6..33f9e1a627cc 100644 --- a/fs/proc/root.c +++ b/fs/proc/root.c @@ -23,6 +23,7 @@ #include <linux/pid_namespace.h> #include <linux/parser.h> #include <linux/cred.h> +#include <linux/share_pool.h>
#include "internal.h"
@@ -140,6 +141,7 @@ void __init proc_root_init(void) proc_tty_init(); proc_mkdir("bus", NULL); proc_sys_init(); + proc_sharepool_init();
register_filesystem(&proc_fs_type); } diff --git a/mm/pagewalk.c b/mm/pagewalk.c index 3c0930d94a29..9dd747151f03 100644 --- a/mm/pagewalk.c +++ b/mm/pagewalk.c @@ -3,6 +3,7 @@ #include <linux/highmem.h> #include <linux/sched.h> #include <linux/hugetlb.h> +#include <linux/share_pool.h>
static int walk_pte_range(pmd_t *pmd, unsigned long addr, unsigned long end, struct mm_walk *walk) @@ -178,7 +179,7 @@ static int walk_hugetlb_range(unsigned long addr, unsigned long end, struct mm_walk *walk) { struct vm_area_struct *vma = walk->vma; - struct hstate *h = hstate_vma(vma); + struct hstate *h = is_vm_huge_special(vma) ? &default_hstate : hstate_vma(vma); unsigned long next; unsigned long hmask = huge_page_mask(h); unsigned long sz = huge_page_size(h); @@ -247,7 +248,7 @@ static int __walk_page_range(unsigned long start, unsigned long end, int err = 0; struct vm_area_struct *vma = walk->vma;
- if (vma && is_vm_hugetlb_page(vma)) { + if (vma && ((is_vm_hugetlb_page(vma)) || is_vm_huge_special(vma))) { if (walk->hugetlb_entry) err = walk_hugetlb_range(start, end, walk); } else