From: Jingxian He hejingxian@huawei.com
euleros inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4QPBH CVE: NA
------------
Use PG_hotreplace flag to mark pin pages which need to be hotreplaced to the recover process.
Signed-off-by: Jingxian He hejingxian@huawei.com Reviewed-by: Kefeng Wangwangkefeng.wang@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/page-flags.h | 9 +++++++++ include/trace/events/mmflags.h | 9 ++++++++- 2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index b47a5514ebc8..eb2fe22bc0e9 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -140,6 +140,9 @@ enum pageflags { PG_arch_2, #endif PG_pool, /* Used to track page allocated from dynamic hugetlb pool */ +#ifdef CONFIG_PIN_MEMORY + PG_hotreplace, +#endif
/* Add reserved page flags for internal extension. For the new page * flags which backported from kernel upstream, please place them @@ -431,6 +434,12 @@ PAGEFLAG_FALSE(Mlocked) __CLEARPAGEFLAG_NOOP(Mlocked) TESTSCFLAG_FALSE(Mlocked) #endif
+#ifdef CONFIG_PIN_MEMORY +PAGEFLAG(Hotreplace, hotreplace, PF_ANY) +#else +PAGEFLAG_FALSE(Hotreplace) +#endif + #ifdef CONFIG_ARCH_USES_PG_UNCACHED PAGEFLAG(Uncached, uncached, PF_NO_COMPOUND) #else diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 1a2896fc039e..fba14499b87e 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -87,6 +87,12 @@ #define IF_HAVE_PG_ARCH_2(flag,string) #endif
+#ifdef CONFIG_PIN_MEMORY +#define IF_HAVE_PG_HOTREPLACE(flag, string) ,{1UL << flag, string} +#else +#define IF_HAVE_PG_HOTREPLACE(flag, string) +#endif + #define __def_pageflag_names \ {1UL << PG_locked, "locked" }, \ {1UL << PG_waiters, "waiters" }, \ @@ -115,7 +121,8 @@ IF_HAVE_PG_UNCACHED(PG_uncached, "uncached" ) \ IF_HAVE_PG_HWPOISON(PG_hwpoison, "hwpoison" ) \ IF_HAVE_PG_IDLE(PG_young, "young" ) \ IF_HAVE_PG_IDLE(PG_idle, "idle" ) \ -IF_HAVE_PG_ARCH_2(PG_arch_2, "arch_2" ), \ +IF_HAVE_PG_ARCH_2(PG_arch_2, "arch_2" ) \ +IF_HAVE_PG_HOTREPLACE(PG_hotreplace, "hotreplace" ), \ {1UL << PG_reserve_pgflag_0, "reserve_pgflag_0"}, \ {1UL << PG_reserve_pgflag_1, "reserve_pgflag_1"}