The show_gfp_flags() macro provides human-friendly printing of gfp flags in
tracepoints. However, it is somewhat out of date and missing several flags.
This patches fills in the missing flags, and distinguishes properly between
GFP_ATOMIC and __GFP_ATOMIC which were both translated to "GFP_ATOMIC".
More generally, all __GFP_X flags which were previously printed as GFP_X, are
now printed as __GFP_X, since ommiting the underscores results in output that
doesn't actually match the source code, and can only lead to confusion. Where
both variants are defined equal (e.g. _DMA and _DMA32), the variant without
underscores are preferred.

Also add a note in gfp.h so hopefully future changes will be synced better.

__GFP_MOVABLE is defined twice in include/linux/gfp.h with different comments.
Leave just the newer one, which was intended to replace the old one.

Signed-off-by: Vlastimil Babka <[email protected]>
Cc: Steven Rostedt <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Ingo Molnar <[email protected]>
Cc: Rasmus Villemoes <[email protected]>
Cc: Joonsoo Kim <[email protected]>
Cc: Minchan Kim <[email protected]>
Cc: Sasha Levin <[email protected]>
Cc: "Kirill A. Shutemov" <[email protected]>
Cc: Mel Gorman <[email protected]>
Reviewed-by: Michal Hocko <[email protected]>
---
 include/linux/gfp.h             |  6 ++++-
 include/trace/events/gfpflags.h | 53 ++++++++++++++++++++++++-----------------
 2 files changed, 36 insertions(+), 23 deletions(-)

diff --git a/include/linux/gfp.h b/include/linux/gfp.h
index 28ad5f6494b0..e5f7d222177d 100644
--- a/include/linux/gfp.h
+++ b/include/linux/gfp.h
@@ -9,6 +9,11 @@
 
 struct vm_area_struct;
 
+/*
+ * In case of changes, please don't forget to update
+ * include/trace/events/gfpflags.h
+ */
+
 /* Plain integer GFP bitmasks. Do not use this directly. */
 #define ___GFP_DMA             0x01u
 #define ___GFP_HIGHMEM         0x02u
@@ -48,7 +53,6 @@ struct vm_area_struct;
 #define __GFP_DMA      ((__force gfp_t)___GFP_DMA)
 #define __GFP_HIGHMEM  ((__force gfp_t)___GFP_HIGHMEM)
 #define __GFP_DMA32    ((__force gfp_t)___GFP_DMA32)
-#define __GFP_MOVABLE  ((__force gfp_t)___GFP_MOVABLE)  /* Page is movable */
 #define __GFP_MOVABLE  ((__force gfp_t)___GFP_MOVABLE)  /* ZONE_MOVABLE 
allowed */
 #define GFP_ZONEMASK   (__GFP_DMA|__GFP_HIGHMEM|__GFP_DMA32|__GFP_MOVABLE)
 
diff --git a/include/trace/events/gfpflags.h b/include/trace/events/gfpflags.h
index dde6bf092c8a..f53b216c9311 100644
--- a/include/trace/events/gfpflags.h
+++ b/include/trace/events/gfpflags.h
@@ -11,33 +11,42 @@
 #define show_gfp_flags(flags)                                          \
        (flags) ? __print_flags(flags, "|",                             \
        {(unsigned long)GFP_TRANSHUGE,          "GFP_TRANSHUGE"},       \
-       {(unsigned long)GFP_HIGHUSER_MOVABLE,   "GFP_HIGHUSER_MOVABLE"}, \
+       {(unsigned long)GFP_HIGHUSER_MOVABLE,   "GFP_HIGHUSER_MOVABLE"},\
        {(unsigned long)GFP_HIGHUSER,           "GFP_HIGHUSER"},        \
        {(unsigned long)GFP_USER,               "GFP_USER"},            \
        {(unsigned long)GFP_TEMPORARY,          "GFP_TEMPORARY"},       \
+       {(unsigned long)GFP_KERNEL_ACCOUNT,     "GFP_KERNEL_ACCOUNT"},  \
        {(unsigned long)GFP_KERNEL,             "GFP_KERNEL"},          \
        {(unsigned long)GFP_NOFS,               "GFP_NOFS"},            \
        {(unsigned long)GFP_ATOMIC,             "GFP_ATOMIC"},          \
        {(unsigned long)GFP_NOIO,               "GFP_NOIO"},            \
-       {(unsigned long)__GFP_HIGH,             "GFP_HIGH"},            \
-       {(unsigned long)__GFP_ATOMIC,           "GFP_ATOMIC"},          \
-       {(unsigned long)__GFP_IO,               "GFP_IO"},              \
-       {(unsigned long)__GFP_COLD,             "GFP_COLD"},            \
-       {(unsigned long)__GFP_NOWARN,           "GFP_NOWARN"},          \
-       {(unsigned long)__GFP_REPEAT,           "GFP_REPEAT"},          \
-       {(unsigned long)__GFP_NOFAIL,           "GFP_NOFAIL"},          \
-       {(unsigned long)__GFP_NORETRY,          "GFP_NORETRY"},         \
-       {(unsigned long)__GFP_COMP,             "GFP_COMP"},            \
-       {(unsigned long)__GFP_ZERO,             "GFP_ZERO"},            \
-       {(unsigned long)__GFP_NOMEMALLOC,       "GFP_NOMEMALLOC"},      \
-       {(unsigned long)__GFP_MEMALLOC,         "GFP_MEMALLOC"},        \
-       {(unsigned long)__GFP_HARDWALL,         "GFP_HARDWALL"},        \
-       {(unsigned long)__GFP_THISNODE,         "GFP_THISNODE"},        \
-       {(unsigned long)__GFP_RECLAIMABLE,      "GFP_RECLAIMABLE"},     \
-       {(unsigned long)__GFP_MOVABLE,          "GFP_MOVABLE"},         \
-       {(unsigned long)__GFP_NOTRACK,          "GFP_NOTRACK"},         \
-       {(unsigned long)__GFP_DIRECT_RECLAIM,   "GFP_DIRECT_RECLAIM"},  \
-       {(unsigned long)__GFP_KSWAPD_RECLAIM,   "GFP_KSWAPD_RECLAIM"},  \
-       {(unsigned long)__GFP_OTHER_NODE,       "GFP_OTHER_NODE"}       \
-       ) : "GFP_NOWAIT"
+       {(unsigned long)GFP_NOWAIT,             "GFP_NOWAIT"},          \
+       {(unsigned long)GFP_DMA,                "GFP_DMA"},             \
+       {(unsigned long)__GFP_HIGHMEM,          "__GFP_HIGHMEM"},       \
+       {(unsigned long)GFP_DMA32,              "GFP_DMA32"},           \
+       {(unsigned long)__GFP_HIGH,             "__GFP_HIGH"},          \
+       {(unsigned long)__GFP_ATOMIC,           "__GFP_ATOMIC"},        \
+       {(unsigned long)__GFP_IO,               "__GFP_IO"},            \
+       {(unsigned long)__GFP_FS,               "__GFP_FS"},            \
+       {(unsigned long)__GFP_COLD,             "__GFP_COLD"},          \
+       {(unsigned long)__GFP_NOWARN,           "__GFP_NOWARN"},        \
+       {(unsigned long)__GFP_REPEAT,           "__GFP_REPEAT"},        \
+       {(unsigned long)__GFP_NOFAIL,           "__GFP_NOFAIL"},        \
+       {(unsigned long)__GFP_NORETRY,          "__GFP_NORETRY"},       \
+       {(unsigned long)__GFP_COMP,             "__GFP_COMP"},          \
+       {(unsigned long)__GFP_ZERO,             "__GFP_ZERO"},          \
+       {(unsigned long)__GFP_NOMEMALLOC,       "__GFP_NOMEMALLOC"},    \
+       {(unsigned long)__GFP_MEMALLOC,         "__GFP_MEMALLOC"},      \
+       {(unsigned long)__GFP_HARDWALL,         "__GFP_HARDWALL"},      \
+       {(unsigned long)__GFP_THISNODE,         "__GFP_THISNODE"},      \
+       {(unsigned long)__GFP_RECLAIMABLE,      "__GFP_RECLAIMABLE"},   \
+       {(unsigned long)__GFP_MOVABLE,          "__GFP_MOVABLE"},       \
+       {(unsigned long)__GFP_ACCOUNT,          "__GFP_ACCOUNT"},       \
+       {(unsigned long)__GFP_NOTRACK,          "__GFP_NOTRACK"},       \
+       {(unsigned long)__GFP_WRITE,            "__GFP_WRITE"},         \
+       {(unsigned long)__GFP_RECLAIM,          "__GFP_RECLAIM"},       \
+       {(unsigned long)__GFP_DIRECT_RECLAIM,   "__GFP_DIRECT_RECLAIM"},\
+       {(unsigned long)__GFP_KSWAPD_RECLAIM,   "__GFP_KSWAPD_RECLAIM"},\
+       {(unsigned long)__GFP_OTHER_NODE,       "__GFP_OTHER_NODE"}     \
+       ) : "none"
 
-- 
2.7.0

Reply via email to