• V
    mm, printk: introduce new format string for flags · edf14cdb
    Vlastimil Babka 提交于
    In mm we use several kinds of flags bitfields that are sometimes printed
    for debugging purposes, or exported to userspace via sysfs.  To make
    them easier to interpret independently on kernel version and config, we
    want to dump also the symbolic flag names.  So far this has been done
    with repeated calls to pr_cont(), which is unreliable on SMP, and not
    usable for e.g.  sysfs export.
    
    To get a more reliable and universal solution, this patch extends
    printk() format string for pointers to handle the page flags (%pGp),
    gfp_flags (%pGg) and vma flags (%pGv).  Existing users of
    dump_flag_names() are converted and simplified.
    
    It would be possible to pass flags by value instead of pointer, but the
    %p format string for pointers already has extensions for various kernel
    structures, so it's a good fit, and the extra indirection in a
    non-critical path is negligible.
    
    [linux@rasmusvillemoes.dk: lots of good implementation suggestions]
    Signed-off-by: NVlastimil Babka <vbabka@suse.cz>
    Acked-by: NMichal Hocko <mhocko@suse.com>
    Cc: Steven Rostedt <rostedt@goodmis.org>
    Cc: Peter Zijlstra <peterz@infradead.org>
    Cc: Arnaldo Carvalho de Melo <acme@kernel.org>
    Cc: Ingo Molnar <mingo@redhat.com>
    Cc: Rasmus Villemoes <linux@rasmusvillemoes.dk>
    Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: Sasha Levin <sasha.levin@oracle.com>
    Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
    Cc: Mel Gorman <mgorman@suse.de>
    Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
    edf14cdb
internal.h 14.6 KB