ANDROID: GKI: Add pageflags for OEM

Add PG_oem_reserved_x pageflags for OEM on 64-bit platform.

These new flags can be used to indicate different states of page.
For example, we can use these pageflags to identify anonymous pages
at different ZRAM compression rates.
These flags will be used in conjunction with different Android
application states. Therefore, I think this is not a generic
modification for all Linux devices and is not suitable for upstream
submission.

Bug: 336964184
Change-Id: Ie68087248866af63ac516d96e3af85222e7a0b50
Signed-off-by: Xiaofeng Yuan <yuanxiaofeng@vivo.com>
This commit is contained in:
Xiaofeng Yuan 2024-06-25 19:51:30 +08:00
parent c7d7f8476d
commit a5d073d697
2 changed files with 19 additions and 0 deletions

View File

@ -141,6 +141,12 @@ enum pageflags {
#endif
#ifdef CONFIG_KASAN_HW_TAGS
PG_skip_kasan_poison,
#endif
#if defined(CONFIG_64BIT) && !defined(CONFIG_NUMA_BALANCING)
PG_oem_reserved_1,
PG_oem_reserved_2,
PG_oem_reserved_3,
PG_oem_reserved_4,
#endif
__NR_PAGEFLAGS,

View File

@ -83,8 +83,17 @@
#ifdef CONFIG_64BIT
#define IF_HAVE_PG_ARCH_2(flag,string) ,{1UL << flag, string}
/* With CONFIG_NUMA_BALANCING LAST_CPUPID_WIDTH consumes OEM-used page flags */
#ifdef CONFIG_NUMA_BALANCING
#define IF_HAVE_PG_OEM_RESERVED(flag,string)
#else
#define IF_HAVE_PG_OEM_RESERVED(flag,string) ,{1UL << flag, string}
#endif
#else
#define IF_HAVE_PG_ARCH_2(flag,string)
#define IF_HAVE_PG_OEM_RESERVED(flag,string)
#endif
#ifdef CONFIG_KASAN_HW_TAGS
@ -121,6 +130,10 @@ 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_OEM_RESERVED(PG_oem_reserved_1,"oem_reserved_1") \
IF_HAVE_PG_OEM_RESERVED(PG_oem_reserved_2,"oem_reserved_2") \
IF_HAVE_PG_OEM_RESERVED(PG_oem_reserved_3,"oem_reserved_3") \
IF_HAVE_PG_OEM_RESERVED(PG_oem_reserved_4,"oem_reserved_4") \
IF_HAVE_PG_SKIP_KASAN_POISON(PG_skip_kasan_poison, "skip_kasan_poison")
#define show_page_flags(flags) \