* [PATCH] proc: export page young and skip_kasan_poison flag via kpageflags
@ 2022-06-02 15:43 Xin Hao
2022-06-02 18:04 ` Andrew Morton
2022-06-02 18:28 ` Matthew Wilcox
0 siblings, 2 replies; 7+ messages in thread
From: Xin Hao @ 2022-06-02 15:43 UTC (permalink / raw)
To: changbin.du; +Cc: sashal, akpm, adobriyan, linux-fsdevel, linux-kernel, xhao
Now the young and skip_kasan_poison flag are supported in
show_page_flags(), but we can not get them from /proc/kpageflags,
So there add them.
Signed-off-by: Xin Hao <xhao@linux.alibaba.com>
---
fs/proc/page.c | 6 ++++++
include/linux/kernel-page-flags.h | 2 ++
tools/vm/page-types.c | 4 ++++
3 files changed, 12 insertions(+)
diff --git a/fs/proc/page.c b/fs/proc/page.c
index 9f1077d94cde..fd28e1d92c5c 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -220,6 +220,12 @@ u64 stable_page_flags(struct page *page)
#ifdef CONFIG_64BIT
u |= kpf_copy_bit(k, KPF_ARCH_2, PG_arch_2);
#endif
+#if defined(CONFIG_PAGE_IDLE_FLAG) && defined(CONFIG_64BIT)
+ u |= kpf_copy_bit(k, KPF_YOUNG, PG_young);
+#endif
+#ifdef CONFIG_KASAN_HW_TAGS
+ u |= kpf_copy_bit(k, KPF_SKIP_KASAN_POSION, PG_skip_kasan_poison);
+#endif
return u;
};
diff --git a/include/linux/kernel-page-flags.h b/include/linux/kernel-page-flags.h
index eee1877a354e..30aaa0ee4ca9 100644
--- a/include/linux/kernel-page-flags.h
+++ b/include/linux/kernel-page-flags.h
@@ -18,5 +18,7 @@
#define KPF_UNCACHED 39
#define KPF_SOFTDIRTY 40
#define KPF_ARCH_2 41
+#define KPF_YOUNG 42
+#define KPF_SKIP_KASAN_POSION 43
#endif /* LINUX_KERNEL_PAGE_FLAGS_H */
diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c
index b1ed76d9a979..2671b746d11f 100644
--- a/tools/vm/page-types.c
+++ b/tools/vm/page-types.c
@@ -79,6 +79,8 @@
#define KPF_UNCACHED 39
#define KPF_SOFTDIRTY 40
#define KPF_ARCH_2 41
+#define KPF_YOUNG 42
+#define KPF_SKIP_KASAN_POSION 43
/* [48-] take some arbitrary free slots for expanding overloaded flags
* not part of kernel API
@@ -137,6 +139,8 @@ static const char * const page_flag_names[] = {
[KPF_UNCACHED] = "c:uncached",
[KPF_SOFTDIRTY] = "f:softdirty",
[KPF_ARCH_2] = "H:arch_2",
+ [KPF_YOUNG] = "y:young",
+ [KPF_SKIP_KASAN_POSION] = "K:skip_kasan_posion",
[KPF_READAHEAD] = "I:readahead",
[KPF_SLOB_FREE] = "P:slob_free",
--
2.31.0
^ permalink raw reply related [flat|nested] 7+ messages in thread* Re: [PATCH] proc: export page young and skip_kasan_poison flag via kpageflags
2022-06-02 15:43 [PATCH] proc: export page young and skip_kasan_poison flag via kpageflags Xin Hao
@ 2022-06-02 18:04 ` Andrew Morton
2022-06-04 9:51 ` Xin Hao
2022-06-02 18:28 ` Matthew Wilcox
1 sibling, 1 reply; 7+ messages in thread
From: Andrew Morton @ 2022-06-02 18:04 UTC (permalink / raw)
To: Xin Hao; +Cc: changbin.du, sashal, adobriyan, linux-fsdevel, linux-kernel
On Thu, 2 Jun 2022 23:43:02 +0800 Xin Hao <xhao@linux.alibaba.com> wrote:
> Now the young and skip_kasan_poison flag are supported in
> show_page_flags(), but we can not get them from /proc/kpageflags,
> So there add them.
Can we have a documentation update please?
hp2:/usr/src/25> grep -rl kpageflags Documentation
Documentation/admin-guide/mm/idle_page_tracking.rst
Documentation/admin-guide/mm/pagemap.rst
Documentation/filesystems/proc.rst
Documentation/translations/zh_CN/vm/hwpoison.rst
Documentation/vm/hwpoison.rst
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] proc: export page young and skip_kasan_poison flag via kpageflags
2022-06-02 18:04 ` Andrew Morton
@ 2022-06-04 9:51 ` Xin Hao
0 siblings, 0 replies; 7+ messages in thread
From: Xin Hao @ 2022-06-04 9:51 UTC (permalink / raw)
To: Andrew Morton; +Cc: changbin.du, sashal, adobriyan, linux-fsdevel, linux-kernel
On 6/3/22 2:04 AM, Andrew Morton wrote:
> On Thu, 2 Jun 2022 23:43:02 +0800 Xin Hao <xhao@linux.alibaba.com> wrote:
>
>> Now the young and skip_kasan_poison flag are supported in
>> show_page_flags(), but we can not get them from /proc/kpageflags,
>> So there add them.
> Can we have a documentation update please?
>
> hp2:/usr/src/25> grep -rl kpageflags Documentation
> Documentation/admin-guide/mm/idle_page_tracking.rst
> Documentation/admin-guide/mm/pagemap.rst
> Documentation/filesystems/proc.rst
> Documentation/translations/zh_CN/vm/hwpoison.rst
> Documentation/vm/hwpoison.rst
OK, will do in the next version, thanks
--
Best Regards!
Xin Hao
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] proc: export page young and skip_kasan_poison flag via kpageflags
2022-06-02 15:43 [PATCH] proc: export page young and skip_kasan_poison flag via kpageflags Xin Hao
2022-06-02 18:04 ` Andrew Morton
@ 2022-06-02 18:28 ` Matthew Wilcox
2022-06-04 9:50 ` Xin Hao
1 sibling, 1 reply; 7+ messages in thread
From: Matthew Wilcox @ 2022-06-02 18:28 UTC (permalink / raw)
To: Xin Hao; +Cc: changbin.du, sashal, akpm, adobriyan, linux-fsdevel, linux-kernel
On Thu, Jun 02, 2022 at 11:43:02PM +0800, Xin Hao wrote:
> Now the young and skip_kasan_poison flag are supported in
Why do we want userspace to know about whether skip_kasan_poison is set?
That seems like a kernel-internal detail to me.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] proc: export page young and skip_kasan_poison flag via kpageflags
2022-06-02 18:28 ` Matthew Wilcox
@ 2022-06-04 9:50 ` Xin Hao
2022-06-04 15:08 ` Matthew Wilcox
0 siblings, 1 reply; 7+ messages in thread
From: Xin Hao @ 2022-06-04 9:50 UTC (permalink / raw)
To: Matthew Wilcox
Cc: changbin.du, sashal, akpm, adobriyan, linux-fsdevel, linux-kernel
On 6/3/22 2:28 AM, Matthew Wilcox wrote:
> On Thu, Jun 02, 2022 at 11:43:02PM +0800, Xin Hao wrote:
>> Now the young and skip_kasan_poison flag are supported in
> Why do we want userspace to know about whether skip_kasan_poison is set?
> That seems like a kernel-internal detail to me.
the skip_kasan_poison also a page flags, we use page_types tool to
display them not only include user-internal,
but also kernel-internal, add them, the page-types tool can more detail
display the kernel-internal page flags,
just in case we don't miss some page flags when check the whole memory.
-
Best Regards!
Xin Hao
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] proc: export page young and skip_kasan_poison flag via kpageflags
2022-06-04 9:50 ` Xin Hao
@ 2022-06-04 15:08 ` Matthew Wilcox
2022-06-05 5:25 ` Xin Hao
0 siblings, 1 reply; 7+ messages in thread
From: Matthew Wilcox @ 2022-06-04 15:08 UTC (permalink / raw)
To: Xin Hao; +Cc: changbin.du, sashal, akpm, adobriyan, linux-fsdevel, linux-kernel
On Sat, Jun 04, 2022 at 05:50:31PM +0800, Xin Hao wrote:
>
> On 6/3/22 2:28 AM, Matthew Wilcox wrote:
> > On Thu, Jun 02, 2022 at 11:43:02PM +0800, Xin Hao wrote:
> > > Now the young and skip_kasan_poison flag are supported in
> > Why do we want userspace to know about whether skip_kasan_poison is set?
> > That seems like a kernel-internal detail to me.
>
> the skip_kasan_poison also a page flags, we use page_types tool to display
> them not only include user-internal,
>
> but also kernel-internal, add them, the page-types tool can more detail
> display the kernel-internal page flags,
>
> just in case we don't miss some page flags when check the whole memory.
So you're just being completist? You don't have a reason to expose this
information?
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] proc: export page young and skip_kasan_poison flag via kpageflags
2022-06-04 15:08 ` Matthew Wilcox
@ 2022-06-05 5:25 ` Xin Hao
0 siblings, 0 replies; 7+ messages in thread
From: Xin Hao @ 2022-06-05 5:25 UTC (permalink / raw)
To: Matthew Wilcox; +Cc: sashal, akpm, adobriyan, linux-fsdevel, linux-kernel
Hi, Matthew:
On 6/4/22 11:08 PM, Matthew Wilcox wrote:
> On Sat, Jun 04, 2022 at 05:50:31PM +0800, Xin Hao wrote:
>> On 6/3/22 2:28 AM, Matthew Wilcox wrote:
>>> On Thu, Jun 02, 2022 at 11:43:02PM +0800, Xin Hao wrote:
>>>> Now the young and skip_kasan_poison flag are supported in
>>> Why do we want userspace to know about whether skip_kasan_poison is set?
>>> That seems like a kernel-internal detail to me.
>> the skip_kasan_poison also a page flags, we use page_types tool to display
>> them not only include user-internal,
>>
>> but also kernel-internal, add them, the page-types tool can more detail
>> display the kernel-internal page flags,
>>
>> just in case we don't miss some page flags when check the whole memory.
> So you're just being completist? You don't have a reason to expose this
> information?
Yes, about the skip_kasan_poison, i just want the kpageflags to support
it, i think it should be included,
the mainly region is i want get the page node info from the kpageflags
in my next patch, when i check these
codes, i see there lost some info about the skip_kasan_poison and young
flags, the page_types tool also check
the kasan pages, so i think it should be included.
Thanks.
--
Best Regards!
Xin Hao
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2022-06-05 5:25 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-06-02 15:43 [PATCH] proc: export page young and skip_kasan_poison flag via kpageflags Xin Hao
2022-06-02 18:04 ` Andrew Morton
2022-06-04 9:51 ` Xin Hao
2022-06-02 18:28 ` Matthew Wilcox
2022-06-04 9:50 ` Xin Hao
2022-06-04 15:08 ` Matthew Wilcox
2022-06-05 5:25 ` Xin Hao
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).