linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] proc/kpageflags: add KPF_WAITERS
@ 2018-02-11 10:36 Konstantin Khlebnikov
  2018-02-16 23:57 ` Andrew Morton
  2018-02-17  8:15 ` [PATCH] Documentation/vm/pagemap.txt: document bit WAITERS Konstantin Khlebnikov
  0 siblings, 2 replies; 5+ messages in thread
From: Konstantin Khlebnikov @ 2018-02-11 10:36 UTC (permalink / raw)
  To: linux-mm, Andrew Morton, linux-kernel
  Cc: Naoya Horiguchi, Michal Hocko, Linus Torvalds, Kirill A. Shutemov,
	Nicholas Piggin

KPF_WAITERS indicates tasks are waiting for a page lock or writeback.
This might be false-positive, in this case next unlock will clear it.
This looks like worth information not only for kernel hacking.

In tool page-types in non-raw mode treat KPF_WAITERS without
KPF_LOCKED and KPF_WRITEBACK as false-positive and hide it.

Signed-off-by: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
---
 fs/proc/page.c                         |    1 +
 include/uapi/linux/kernel-page-flags.h |    1 +
 tools/vm/page-types.c                  |    7 +++++++
 3 files changed, 9 insertions(+)

diff --git a/fs/proc/page.c b/fs/proc/page.c
index 1491918a33c3..b9312e1124af 100644
--- a/fs/proc/page.c
+++ b/fs/proc/page.c
@@ -159,6 +159,7 @@ u64 stable_page_flags(struct page *page)
 		u |= 1 << KPF_IDLE;
 
 	u |= kpf_copy_bit(k, KPF_LOCKED,	PG_locked);
+	u |= kpf_copy_bit(k, KPF_WAITERS,	PG_waiters);
 
 	u |= kpf_copy_bit(k, KPF_SLAB,		PG_slab);
 	if (PageTail(page) && PageSlab(compound_head(page)))
diff --git a/include/uapi/linux/kernel-page-flags.h b/include/uapi/linux/kernel-page-flags.h
index fa139841ec18..1118a028f2b3 100644
--- a/include/uapi/linux/kernel-page-flags.h
+++ b/include/uapi/linux/kernel-page-flags.h
@@ -35,6 +35,7 @@
 #define KPF_BALLOON		23
 #define KPF_ZERO_PAGE		24
 #define KPF_IDLE		25
+#define KPF_WAITERS		26
 
 
 #endif /* _UAPILINUX_KERNEL_PAGE_FLAGS_H */
diff --git a/tools/vm/page-types.c b/tools/vm/page-types.c
index a8783f48f77f..76d880b768b5 100644
--- a/tools/vm/page-types.c
+++ b/tools/vm/page-types.c
@@ -107,6 +107,7 @@
 
 static const char * const page_flag_names[] = {
 	[KPF_LOCKED]		= "L:locked",
+	[KPF_WAITERS]		= "Q:waiters",
 	[KPF_ERROR]		= "E:error",
 	[KPF_REFERENCED]	= "R:referenced",
 	[KPF_UPTODATE]		= "U:uptodate",
@@ -498,6 +499,12 @@ static uint64_t well_known_flags(uint64_t flags)
 	if ((flags & BITS_COMPOUND) && !(flags & BIT(HUGE)))
 		flags &= ~BITS_COMPOUND;
 
+	/* Treat WAITERS without LOCKED or WRITEBACK as false-postive */
+	if ((flags & (BIT(WAITERS) |
+		      BIT(LOCKED) |
+		      BIT(WRITEBACK))) == BIT(WAITERS))
+		flags &= ~BIT(WAITERS);
+
 	return flags;
 }
 

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-02-21  0:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-02-11 10:36 [PATCH] proc/kpageflags: add KPF_WAITERS Konstantin Khlebnikov
2018-02-16 23:57 ` Andrew Morton
2018-02-17  8:14   ` Konstantin Khlebnikov
2018-02-21  0:00     ` Andrew Morton
2018-02-17  8:15 ` [PATCH] Documentation/vm/pagemap.txt: document bit WAITERS Konstantin Khlebnikov

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).