[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210714091800.42645-3-songmuchun@bytedance.com>
Date: Wed, 14 Jul 2021 17:17:57 +0800
From: Muchun Song <songmuchun@...edance.com>
To: mike.kravetz@...cle.com, akpm@...ux-foundation.org,
osalvador@...e.de, mhocko@...e.com, song.bao.hua@...ilicon.com,
david@...hat.com, chenhuang5@...wei.com, bodeddub@...zon.com,
corbet@....net
Cc: duanxiongchun@...edance.com, fam.zheng@...edance.com,
linux-doc@...r.kernel.org, linux-kernel@...r.kernel.org,
linux-mm@...ck.org, zhengqi.arch@...edance.com,
Muchun Song <songmuchun@...edance.com>
Subject: [PATCH 2/5] mm: introduce save_page_flags to cooperate with show_page_flags
Introduce save_page_flags to return the page flags which can cooperate
with show_page_flags. If we want to hihe some page flags from users, it
will be useful to alter save_page_flags directly. This is a preparation
for the next patch to hide some page flags from users.
Signed-off-by: Muchun Song <songmuchun@...edance.com>
---
include/trace/events/mmflags.h | 3 +++
include/trace/events/page_ref.h | 8 ++++----
2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/include/trace/events/mmflags.h b/include/trace/events/mmflags.h
index 390270e00a1d..69cb84b1257e 100644
--- a/include/trace/events/mmflags.h
+++ b/include/trace/events/mmflags.h
@@ -121,6 +121,9 @@ IF_HAVE_PG_IDLE(PG_idle, "idle" ) \
IF_HAVE_PG_ARCH_2(PG_arch_2, "arch_2" ) \
IF_HAVE_PG_SKIP_KASAN_POISON(PG_skip_kasan_poison, "skip_kasan_poison")
+#define save_page_flags(page) \
+ (((page)->flags & ~PAGEFLAGS_MASK))
+
#define show_page_flags(flags) \
(flags) ? __print_flags(flags, "|", \
__def_pageflag_names \
diff --git a/include/trace/events/page_ref.h b/include/trace/events/page_ref.h
index 643b1b4e9f27..53d303048d27 100644
--- a/include/trace/events/page_ref.h
+++ b/include/trace/events/page_ref.h
@@ -28,7 +28,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_template,
TP_fast_assign(
__entry->pfn = page_to_pfn(page);
- __entry->flags = page->flags;
+ __entry->flags = save_page_flags(page);
__entry->count = page_ref_count(page);
__entry->mapcount = page_mapcount(page);
__entry->mapping = page->mapping;
@@ -38,7 +38,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_template,
TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d",
__entry->pfn,
- show_page_flags(__entry->flags & ~PAGEFLAGS_MASK),
+ show_page_flags(__entry->flags),
__entry->count,
__entry->mapcount, __entry->mapping, __entry->mt,
__entry->val)
@@ -77,7 +77,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template,
TP_fast_assign(
__entry->pfn = page_to_pfn(page);
- __entry->flags = page->flags;
+ __entry->flags = save_page_flags(page);
__entry->count = page_ref_count(page);
__entry->mapcount = page_mapcount(page);
__entry->mapping = page->mapping;
@@ -88,7 +88,7 @@ DECLARE_EVENT_CLASS(page_ref_mod_and_test_template,
TP_printk("pfn=0x%lx flags=%s count=%d mapcount=%d mapping=%p mt=%d val=%d ret=%d",
__entry->pfn,
- show_page_flags(__entry->flags & ~PAGEFLAGS_MASK),
+ show_page_flags(__entry->flags),
__entry->count,
__entry->mapcount, __entry->mapping, __entry->mt,
__entry->val, __entry->ret)
--
2.11.0
Powered by blists - more mailing lists