From: Peng Liang liangpeng10@huawei.com
euleros inclusion category: feature bugzilla: https://gitee.com/openeuler/kernel/issues/I4OELI CVE: NA
-------------------------------------------------
24 page flags are used in 32-bit architectures and 27 page flags are used in 64-bit ones currently. And 23 gfp flags are used currently. Add 2 reserved page and gfp flags for internal extension. For the new flags which backported from kernel upstream, place them behind the reserved flags.
Signed-off-by: Peng Liang liangpeng10@huawei.com Reviewed-by: Kefeng Wang wangkefeng.wang@huawei.com Signed-off-by: Zheng Zengkai zhengzengkai@huawei.com --- include/linux/gfp.h | 10 ++++++++-- include/linux/page-flags.h | 8 ++++++++ include/trace/events/mmflags.h | 8 ++++++-- tools/perf/builtin-kmem.c | 2 ++ 4 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 22fc743ddf23..80efbea0c9d7 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -39,8 +39,10 @@ struct vm_area_struct; #define ___GFP_HARDWALL 0x100000u #define ___GFP_THISNODE 0x200000u #define ___GFP_ACCOUNT 0x400000u +#define ___GFP_RESERVE_0 0x800000u +#define ___GFP_RESERVE_1 0x1000000u #ifdef CONFIG_LOCKDEP -#define ___GFP_NOLOCKDEP 0x800000u +#define ___GFP_NOLOCKDEP 0x2000000u #else #define ___GFP_NOLOCKDEP 0 #endif @@ -223,8 +225,12 @@ struct vm_area_struct; /* Disable lockdep for GFP context tracking */ #define __GFP_NOLOCKDEP ((__force gfp_t)___GFP_NOLOCKDEP)
+/* Reserve 2 flags for future usage */ +#define __GFP_RESERVE_0 ((__force gfp_t)___GFP_RESERVE_0) +#define __GFP_RESERVE_1 ((__force gfp_t)___GFP_RESERVE_1) + /* Room for N __GFP_FOO bits */ -#define __GFP_BITS_SHIFT (23 + IS_ENABLED(CONFIG_LOCKDEP)) +#define __GFP_BITS_SHIFT (25 + IS_ENABLED(CONFIG_LOCKDEP)) #define __GFP_BITS_MASK ((__force gfp_t)((1 << __GFP_BITS_SHIFT) - 1))
/** diff --git a/include/linux/page-flags.h b/include/linux/page-flags.h index 56d9a03119a3..18dbfa2a7c5f 100644 --- a/include/linux/page-flags.h +++ b/include/linux/page-flags.h @@ -139,6 +139,14 @@ enum pageflags { #ifdef CONFIG_64BIT PG_arch_2, #endif + + /* Add reserved page flags for internal extension. For the new page + * flags which backported from kernel upstream, please place them + * behind the reserved page flags. + */ + PG_reserve_pgflag_0, + PG_reserve_pgflag_1, + __NR_PAGEFLAGS,
/* Filesystems */ diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h index 792e0a2fa775..30700ccb1eea 100644 --- a/include/trace/events/mmflags.h +++ b/include/trace/events/mmflags.h @@ -48,7 +48,9 @@ {(unsigned long)__GFP_WRITE, "__GFP_WRITE"}, \ {(unsigned long)__GFP_RECLAIM, "__GFP_RECLAIM"}, \ {(unsigned long)__GFP_DIRECT_RECLAIM, "__GFP_DIRECT_RECLAIM"},\ - {(unsigned long)__GFP_KSWAPD_RECLAIM, "__GFP_KSWAPD_RECLAIM"}\ + {(unsigned long)__GFP_KSWAPD_RECLAIM, "__GFP_KSWAPD_RECLAIM"},\ + {(unsigned long)__GFP_RESERVE_0, "__GFP_RESERVE_0"}, \ + {(unsigned long)__GFP_RESERVE_1, "__GFP_RESERVE_1"} \
#define show_gfp_flags(flags) \ (flags) ? __print_flags(flags, "|", \ @@ -112,7 +114,9 @@ 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" ), \ + {1UL << PG_reserve_pgflag_0, "reserve_pgflag_0"}, \ + {1UL << PG_reserve_pgflag_1, "reserve_pgflag_1"}
#define show_page_flags(flags) \ (flags) ? __print_flags(flags, "|", \ diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c index a50dae2c4ae9..ffe9cf4160cf 100644 --- a/tools/perf/builtin-kmem.c +++ b/tools/perf/builtin-kmem.c @@ -660,6 +660,8 @@ static const struct { { "__GFP_RECLAIM", "R" }, { "__GFP_DIRECT_RECLAIM", "DR" }, { "__GFP_KSWAPD_RECLAIM", "KR" }, + { "__GFP_RESERVE_0", "RE0" }, + { "__GFP_RESERVE_1", "RE1" }, };
static size_t max_gfp_len;