From: Andres Lagar-Cavilla <andre...@google.com>

For debugging and testing.

Signed-off-by: Andres Lagar-Cavilla <andre...@google.com>
Signed-off-by: Hugh Dickins <hu...@google.com>
---
This patchset has been based on v4.6-rc2: here we get a clash with
the addition of KPF_MOVABLE in current mmotm, not hard to fix up.

 Documentation/vm/pagemap.txt           |    2 ++
 fs/proc/page.c                         |    6 ++++++
 include/uapi/linux/kernel-page-flags.h |    3 ++-
 tools/vm/page-types.c                  |    2 ++
 4 files changed, 12 insertions(+), 1 deletion(-)

--- a/Documentation/vm/pagemap.txt
+++ b/Documentation/vm/pagemap.txt
@@ -71,6 +71,8 @@ There are four components to pagemap:
     23. BALLOON
     24. ZERO_PAGE
     25. IDLE
+    26. TEAM
+    27. TEAM_PMD_MMAP (only if the whole team is mapped as a pmd at least once)
 
  * /proc/kpagecgroup.  This file contains a 64-bit inode number of the
    memory cgroup each page is charged to, indexed by PFN. Only available when
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -12,6 +12,7 @@
 #include <linux/memcontrol.h>
 #include <linux/mmu_notifier.h>
 #include <linux/page_idle.h>
+#include <linux/pageteam.h>
 #include <linux/kernel-page-flags.h>
 #include <asm/uaccess.h>
 #include "internal.h"
@@ -112,6 +113,11 @@ u64 stable_page_flags(struct page *page)
        if (PageKsm(page))
                u |= 1 << KPF_KSM;
 
+       if (PageTeam(page)) {
+               u |= 1 << KPF_TEAM;
+               if (page == team_head(page) && team_pmd_mapped(page))
+                       u |= 1 << KPF_TEAM_PMD_MMAP;
+       }
        /*
         * compound pages: export both head/tail info
         * they together define a compound page's start/end pos and order
--- a/include/uapi/linux/kernel-page-flags.h
+++ b/include/uapi/linux/kernel-page-flags.h
@@ -34,6 +34,7 @@
 #define KPF_BALLOON            23
 #define KPF_ZERO_PAGE          24
 #define KPF_IDLE               25
-
+#define KPF_TEAM               26
+#define KPF_TEAM_PMD_MMAP      27
 
 #endif /* _UAPILINUX_KERNEL_PAGE_FLAGS_H */
--- a/tools/vm/page-types.c
+++ b/tools/vm/page-types.c
@@ -133,6 +133,8 @@ static const char * const page_flag_name
        [KPF_BALLOON]           = "o:balloon",
        [KPF_ZERO_PAGE]         = "z:zero_page",
        [KPF_IDLE]              = "i:idle_page",
+       [KPF_TEAM]              = "y:team",
+       [KPF_TEAM_PMD_MMAP]     = "Y:team_pmd_mmap",
 
        [KPF_RESERVED]          = "r:reserved",
        [KPF_MLOCKED]           = "m:mlocked",

Reply via email to