The patch titled Subject: mm, debug: introduce dump_gfpflag_names() for symbolic printing of gfp_flags has been removed from the -mm tree. Its filename was mm-debug-introduce-dump_gfpflag_names-for-symbolic-printing-of-gfp_flags.patch This patch was dropped because an updated version will be merged ------------------------------------------------------ From: Vlastimil Babka <vbabka@xxxxxxx> Subject: mm, debug: introduce dump_gfpflag_names() for symbolic printing of gfp_flags It would be useful to convert gfp_flags into string representation when printing them in case of allocation failure, OOM etc. There's a script ./scripts/gfp-translate to make this simpler, but it needs the matching version of the sources to be accurate, and the flags have been undergoing some changes recently. The ftrace framework already has this translation in the form of show_gfp_flags() defined in include/trace/events/gfpflags.h which defines the translation table internally. Allow reusing the table outside ftrace by putting it behind __def_gfpflag_names definition and introduce dump_gfpflag_names() to handle the printing. While at it, also fill in the names for the flags and flag combinations that have been missing in the table. GFP_NOWAIT no longer equals to "no flags", so change the output for no flags to "none". Signed-off-by: Vlastimil Babka <vbabka@xxxxxxx> Cc: Joonsoo Kim <iamjoonsoo.kim@xxxxxxx> Cc: Minchan Kim <minchan@xxxxxxxxxx> Cc: Sasha Levin <sasha.levin@xxxxxxxxxx> Cc: "Kirill A. Shutemov" <kirill.shutemov@xxxxxxxxxxxxxxx> Cc: Mel Gorman <mgorman@xxxxxxx> Cc: Michal Hocko <mhocko@xxxxxxx> Signed-off-by: Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> --- include/linux/mmdebug.h | 1 + include/trace/events/gfpflags.h | 14 +++++++++++--- mm/debug.c | 10 ++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff -puN include/linux/mmdebug.h~mm-debug-introduce-dump_gfpflag_names-for-symbolic-printing-of-gfp_flags include/linux/mmdebug.h --- a/include/linux/mmdebug.h~mm-debug-introduce-dump_gfpflag_names-for-symbolic-printing-of-gfp_flags +++ a/include/linux/mmdebug.h @@ -11,6 +11,7 @@ struct mm_struct; extern void dump_page(struct page *page, const char *reason); extern void dump_page_badflags(struct page *page, const char *reason, unsigned long badflags); +extern void dump_gfpflag_names(unsigned long gfp_flags); void dump_vma(const struct vm_area_struct *vma); void dump_mm(const struct mm_struct *mm); diff -puN include/trace/events/gfpflags.h~mm-debug-introduce-dump_gfpflag_names-for-symbolic-printing-of-gfp_flags include/trace/events/gfpflags.h --- a/include/trace/events/gfpflags.h~mm-debug-introduce-dump_gfpflag_names-for-symbolic-printing-of-gfp_flags +++ a/include/trace/events/gfpflags.h @@ -8,8 +8,8 @@ * * Thus most bits set go first. */ -#define show_gfp_flags(flags) \ - (flags) ? __print_flags(flags, "|", \ + +#define __def_gfpflag_names \ {(unsigned long)GFP_TRANSHUGE, "GFP_TRANSHUGE"}, \ {(unsigned long)GFP_HIGHUSER_MOVABLE, "GFP_HIGHUSER_MOVABLE"}, \ {(unsigned long)GFP_HIGHUSER, "GFP_HIGHUSER"}, \ @@ -19,9 +19,13 @@ {(unsigned long)GFP_NOFS, "GFP_NOFS"}, \ {(unsigned long)GFP_ATOMIC, "GFP_ATOMIC"}, \ {(unsigned long)GFP_NOIO, "GFP_NOIO"}, \ + {(unsigned long)GFP_NOWAIT, "GFP_NOWAIT"}, \ + {(unsigned long)__GFP_DMA, "GFP_DMA"}, \ + {(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"}, \ @@ -36,8 +40,12 @@ {(unsigned long)__GFP_RECLAIMABLE, "GFP_RECLAIMABLE"}, \ {(unsigned long)__GFP_MOVABLE, "GFP_MOVABLE"}, \ {(unsigned long)__GFP_NOTRACK, "GFP_NOTRACK"}, \ + {(unsigned long)__GFP_WRITE, "GFP_WRITE"}, \ {(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" +#define show_gfp_flags(flags) \ + (flags) ? __print_flags(flags, "|", \ + __def_gfpflag_names \ + ) : "none" diff -puN mm/debug.c~mm-debug-introduce-dump_gfpflag_names-for-symbolic-printing-of-gfp_flags mm/debug.c --- a/mm/debug.c~mm-debug-introduce-dump_gfpflag_names-for-symbolic-printing-of-gfp_flags +++ a/mm/debug.c @@ -10,6 +10,7 @@ #include <linux/trace_events.h> #include <linux/memcontrol.h> #include <linux/migrate.h> +#include <trace/events/gfpflags.h> char *migrate_reason_names[MR_TYPES] = { "compaction", @@ -57,6 +58,10 @@ static const struct trace_print_flags pa #endif }; +static const struct trace_print_flags gfpflag_names[] = { + __def_gfpflag_names +}; + static void dump_flag_names(unsigned long flags, const struct trace_print_flags *names, int count) { @@ -84,6 +89,11 @@ static void dump_flag_names(unsigned lon pr_cont(")\n"); } +void dump_gfpflag_names(unsigned long gfp_flags) +{ + dump_flag_names(gfp_flags, gfpflag_names, ARRAY_SIZE(gfpflag_names)); +} + void dump_page_badflags(struct page *page, const char *reason, unsigned long badflags) { _ Patches currently in -mm which might be from vbabka@xxxxxxx are mm-documentation-clarify-proc-pid-status-vmswap-limitations-for-shmem.patch mm-proc-account-for-shmem-swap-in-proc-pid-smaps.patch mm-proc-reduce-cost-of-proc-pid-smaps-for-shmem-mappings.patch mm-proc-reduce-cost-of-proc-pid-smaps-for-unpopulated-shmem-mappings.patch mm-page_owner-dump-page-owner-info-from-dump_page.patch mm-page_alloc-print-symbolic-gfp_flags-on-allocation-failure.patch mm-oom-print-symbolic-gfp_flags-in-oom-warning.patch mm-printk-introduce-new-format-string-for-flags.patch mm-page_owner-provide-symbolic-page-flags-and-gfp_flags.patch mm-debug-move-bad-flags-printing-to-bad_page.patch -- To unsubscribe from this list: send the line "unsubscribe mm-commits" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html