[PATCH v1 1/5] include/uapi/linux/kernel-page-flags.h: define KPF_FOLIO

Naoya Horiguchi
2023-10-10T14:29:15Z

From: Naoya Horiguchi <naoya.horiguchi@nec.com>

Define a new KPF flag to represent folio in /proc/kpageflags and
in-kernel user page-types.c.

Note that in page-types.c I chose 'f' for the character representing folio,
which conflicts with KPF_SOFTDIRTY, but we have no other choice because
all reasonable choices ('f', 'F', 'o', 'O', 'l', 'L', 'i', and 'I') are
already used. You need to pay attention to long flag names or the position
of 'f' in short form.

Signed-off-by: Naoya Horiguchi <naoya.horiguchi@nec.com>
---
include/uapi/linux/kernel-page-flags.h | 1 +
tools/mm/page-types.c | 1 +
2 files changed, 2 insertions(+)

diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h
index 6f2f2720f3ac..9b43dadb7f49 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_FOLIO 27

#endif /* _UAPILINUX_KERNEL_PAGE_FLAGS_H */
diff --git a/tools/mm/page-types.c b/tools/mm/page-types.c
index 8d5595b6c59f..b78448d19e88 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_FOLIO] = "f:folio",

[KPF_RESERVED] = "r:reserved",
[KPF_MLOCKED] = "m:mlocked",
--
2.25.1