From: Liu Shixin liushixin2@huawei.com
hulk inclusion category: feature bugzilla: 46904, https://gitee.com/openeuler/kernel/issues/I4RO84 CVE: NA
--------------------------------
Export PG_pool page flag in /proc/kpageflags.
27. KPF_POOL page is allocated from hpool.
By using this tool, we can easily count the number of pages allocated from dynamic hugetlb pool by a process or a file.
Signed-off-by: Liu Shixin liushixin2@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- fs/proc/page.c | 1 + include/uapi/linux/kernel-page-flags.h | 1 + tools/vm/page-types.c | 1 + 3 files changed, 3 insertions(+)
diff --git a/fs/proc/page.c b/fs/proc/page.c index 9f1077d94cde..d00c23d543fe 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -220,6 +220,7 @@ u64 stable_page_flags(struct page *page) #ifdef CONFIG_64BIT u |= kpf_copy_bit(k, KPF_ARCH_2, PG_arch_2); #endif + u |= kpf_copy_bit(k, KPF_POOL, PG_pool);
return u; }; diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h index 6f2f2720f3ac..f8297cb68bdd 100644 --- a/include/uapi/linux/kernel-page-flags.h +++ b/include/uapi/linux/kernel-page-flags.h @@ -36,5 +36,6 @@ #define KPF_ZERO_PAGE 24 #define KPF_IDLE 25 #define KPF_PGTABLE 26 +#define KPF_POOL 27
#endif /* _UAPILINUX_KERNEL_PAGE_FLAGS_H */ diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c index f62f10c988db..6034477926d6 100644 --- a/tools/vm/page-types.c +++ b/tools/vm/page-types.c @@ -126,6 +126,7 @@ static const char * const page_flag_names[] = { [KPF_PGTABLE] = "g:pgtable", [KPF_ZERO_PAGE] = "z:zero_page", [KPF_IDLE] = "i:idle_page", + [KPF_POOL] = "h:hpool",
[KPF_RESERVED] = "r:reserved", [KPF_MLOCKED] = "m:mlocked",