hulk inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I8S9BY CVE: NA
--------------------------------
Add a new page_flag PG_pool to represent the page allocated from dpool.
Signed-off-by: Liu Shixin liushixin2@huawei.com --- fs/proc/page.c | 3 +++ include/linux/page-flags.h | 12 ++++++++++++ include/trace/events/mmflags.h | 7 +++++++ include/uapi/linux/kernel-page-flags.h | 1 + tools/mm/page-types.c | 1 + 5 files changed, 24 insertions(+)
diff --git a/fs/proc/page.c b/fs/proc/page.c index 195b077c0fac..9a18d79e8724 100644 --- a/fs/proc/page.c +++ b/fs/proc/page.c @@ -222,6 +222,9 @@ u64 stable_page_flags(struct page *page) u |= kpf_copy_bit(k, KPF_ARCH_2, PG_arch_2); u |= kpf_copy_bit(k, KPF_ARCH_3, PG_arch_3); #endif +#ifdef CONFIG_DYNAMIC_POOL + u |= kpf_copy_bit(k, KPF_POOL, PG_pool); +#endif
return u; }; diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index e5cbffddf06d..53060b67f5ef 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -135,6 +135,9 @@ enum pageflags { #ifdef CONFIG_ARCH_USES_PG_ARCH_X PG_arch_2, PG_arch_3, +#endif +#ifdef CONFIG_DYNAMIC_POOL + PG_pool, /* Page is allocated from dynamic pool */ #endif __NR_PAGEFLAGS,
@@ -603,6 +606,15 @@ PAGEFLAG(VmemmapSelfHosted, vmemmap_self_hosted, PF_ANY) PAGEFLAG_FALSE(VmemmapSelfHosted, vmemmap_self_hosted) #endif
+/* + * PagePool() is used to track page allocated from dpool. + */ +#ifdef CONFIG_DYNAMIC_POOL +PAGEFLAG(Pool, pool, PF_NO_TAIL) +#else +PAGEFLAG_FALSE(Pool, pool) +#endif + /* * On an anonymous page mapped into a user virtual memory area, * page->mapping points to its anon_vma, not to a struct address_space; diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 6e24b2fbc445..37962289a7a5 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -90,6 +90,12 @@ #define IF_HAVE_PG_IDLE(_name) #endif
+#ifdef CONFIG_DYNAMIC_POOL +#define IF_HAVE_PG_POOL(_name) ,{1UL << PG_##_name, __stringify(_name)} +#else +#define IF_HAVE_PG_POOL(_name) +#endif + #ifdef CONFIG_ARCH_USES_PG_ARCH_X #define IF_HAVE_PG_ARCH_X(_name) ,{1UL << PG_##_name, __stringify(_name)} #else @@ -125,6 +131,7 @@ IF_HAVE_PG_UNCACHED(uncached) \ IF_HAVE_PG_HWPOISON(hwpoison) \ IF_HAVE_PG_IDLE(idle) \ IF_HAVE_PG_IDLE(young) \ +IF_HAVE_PG_POOL(pool) \ IF_HAVE_PG_ARCH_X(arch_2) \ IF_HAVE_PG_ARCH_X(arch_3)
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/mm/page-types.c b/tools/mm/page-types.c index 8d5595b6c59f..e48d85fc7951 100644 --- a/tools/mm/page-types.c +++ b/tools/mm/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] = "p:pool",
[KPF_RESERVED] = "r:reserved", [KPF_MLOCKED] = "m:mlocked",