linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	linux-mm@kvack.org, linux-kernel@vger.kernel.org,
	Steven Rostedt <rostedt@goodmis.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Ingo Molnar <mingo@redhat.com>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>,
	Joonsoo Kim <iamjoonsoo.kim@lge.com>,
	Minchan Kim <minchan@kernel.org>,
	Sasha Levin <sasha.levin@oracle.com>,
	"Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>,
	Mel Gorman <mgorman@suse.de>
Subject: Re: [PATCH v3 06/14] mm, debug: replace dump_flags() with the new printk formats
Date: Thu, 7 Jan 2016 10:57:56 +0100	[thread overview]
Message-ID: <20160107095756.GF27868@dhcp22.suse.cz> (raw)
In-Reply-To: <1450429406-7081-7-git-send-email-vbabka@suse.cz>

On Fri 18-12-15 10:03:18, Vlastimil Babka wrote:
> With the new printk format strings for flags, we can get rid of dump_flags()
> in mm/debug.c.
> 
> This also fixes dump_vma() which used dump_flags() for printing vma flags.
> However dump_flags() did a page-flags specific filtering of bits higher than
> NR_PAGEFLAGS in order to remove the zone id part. For dump_vma() this resulted
> in removing several VM_* flags from the symbolic translation.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> 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>
> Cc: Michal Hocko <mhocko@suse.cz>

Nice simplification for sure!
Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  mm/debug.c | 60 ++++++++++++++----------------------------------------------
>  1 file changed, 14 insertions(+), 46 deletions(-)
> 
> diff --git a/mm/debug.c b/mm/debug.c
> index 79621a5ce46f..5ea57bc49ef6 100644
> --- a/mm/debug.c
> +++ b/mm/debug.c
> @@ -28,36 +28,6 @@ const struct trace_print_flags vmaflag_names[] = {
>  	{0, NULL}
>  };
>  
> -static void dump_flags(unsigned long flags,
> -			const struct trace_print_flags *names, int count)
> -{
> -	const char *delim = "";
> -	unsigned long mask;
> -	int i;
> -
> -	pr_emerg("flags: %#lx(", flags);
> -
> -	/* remove zone id */
> -	flags &= (1UL << NR_PAGEFLAGS) - 1;
> -
> -	for (i = 0; i < count && flags; i++) {
> -
> -		mask = names[i].mask;
> -		if ((flags & mask) != mask)
> -			continue;
> -
> -		flags &= ~mask;
> -		pr_cont("%s%s", delim, names[i].name);
> -		delim = "|";
> -	}
> -
> -	/* check for left over flags */
> -	if (flags)
> -		pr_cont("%s%#lx", delim, flags);
> -
> -	pr_cont(")\n");
> -}
> -
>  void dump_page_badflags(struct page *page, const char *reason,
>  		unsigned long badflags)
>  {
> @@ -68,15 +38,15 @@ void dump_page_badflags(struct page *page, const char *reason,
>  		pr_cont(" compound_mapcount: %d", compound_mapcount(page));
>  	pr_cont("\n");
>  	BUILD_BUG_ON(ARRAY_SIZE(pageflag_names) != __NR_PAGEFLAGS + 1);
> -	dump_flags(page->flags, pageflag_names,
> -					ARRAY_SIZE(pageflag_names) - 1);
> +	pr_emerg("flags: %#lx(%pgp)\n", page->flags, &page->flags);
> +
>  	if (reason)
>  		pr_alert("page dumped because: %s\n", reason);
> -	if (page->flags & badflags) {
> -		pr_alert("bad because of flags:\n");
> -		dump_flags(page->flags & badflags, pageflag_names,
> -					ARRAY_SIZE(pageflag_names) - 1);
> -	}
> +
> +	badflags &= page->flags;
> +	if (badflags)
> +		pr_alert("bad because of flags: %#lx(%pgp)\n", badflags,
> +								&badflags);
>  #ifdef CONFIG_MEMCG
>  	if (page->mem_cgroup)
>  		pr_alert("page->mem_cgroup:%p\n", page->mem_cgroup);
> @@ -96,13 +66,14 @@ void dump_vma(const struct vm_area_struct *vma)
>  	pr_emerg("vma %p start %p end %p\n"
>  		"next %p prev %p mm %p\n"
>  		"prot %lx anon_vma %p vm_ops %p\n"
> -		"pgoff %lx file %p private_data %p\n",
> +		"pgoff %lx file %p private_data %p\n"
> +		"flags: %#lx(%pgv)\n",
>  		vma, (void *)vma->vm_start, (void *)vma->vm_end, vma->vm_next,
>  		vma->vm_prev, vma->vm_mm,
>  		(unsigned long)pgprot_val(vma->vm_page_prot),
>  		vma->anon_vma, vma->vm_ops, vma->vm_pgoff,
> -		vma->vm_file, vma->vm_private_data);
> -	dump_flags(vma->vm_flags, vmaflag_names, ARRAY_SIZE(vmaflag_names) - 1);
> +		vma->vm_file, vma->vm_private_data,
> +		vma->vm_flags, &vma->vm_flags);
>  }
>  EXPORT_SYMBOL(dump_vma);
>  
> @@ -136,7 +107,7 @@ void dump_mm(const struct mm_struct *mm)
>  #if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION)
>  		"tlb_flush_pending %d\n"
>  #endif
> -		"%s",	/* This is here to hold the comma */
> +		"def_flags: %#lx(%pgv)\n",
>  
>  		mm, mm->mmap, mm->vmacache_seqnum, mm->task_size,
>  #ifdef CONFIG_MMU
> @@ -170,11 +141,8 @@ void dump_mm(const struct mm_struct *mm)
>  #if defined(CONFIG_NUMA_BALANCING) || defined(CONFIG_COMPACTION)
>  		mm->tlb_flush_pending,
>  #endif
> -		""		/* This is here to not have a comma! */
> -		);
> -
> -		dump_flags(mm->def_flags, vmaflag_names,
> -				ARRAY_SIZE(vmaflag_names) - 1);
> +		mm->def_flags, &mm->def_flags
> +	);
>  }
>  
>  #endif		/* CONFIG_DEBUG_VM */
> -- 
> 2.6.3

-- 
Michal Hocko
SUSE Labs

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

  reply	other threads:[~2016-01-07  9:57 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-18  9:03 [PATCH v3 00/14] mm flags in printk, page_owner improvements for debugging Vlastimil Babka
2015-12-18  9:03 ` [PATCH v3 01/14] tracepoints: move trace_print_flags definitions to tracepoint-defs.h Vlastimil Babka
2015-12-18  9:03 ` [PATCH v3 02/14] mm, tracing: make show_gfp_flags() up to date Vlastimil Babka
2016-01-07  9:29   ` Michal Hocko
2015-12-18  9:03 ` [PATCH v3 03/14] tools, perf: make gfp_compact_table " Vlastimil Babka
2015-12-18  9:03 ` [PATCH v3 04/14] mm, tracing: unify mm flags handling in tracepoints and printk Vlastimil Babka
2016-01-07  9:46   ` Michal Hocko
2015-12-18  9:03 ` [PATCH v3 05/14] mm, printk: introduce new format string for flags Vlastimil Babka
2016-01-07  9:53   ` Michal Hocko
2015-12-18  9:03 ` [PATCH v3 06/14] mm, debug: replace dump_flags() with the new printk formats Vlastimil Babka
2016-01-07  9:57   ` Michal Hocko [this message]
2015-12-18  9:03 ` [PATCH v3 07/14] mm, page_alloc: print symbolic gfp_flags on allocation failure Vlastimil Babka
2015-12-18  9:03 ` [PATCH v3 08/14] mm, oom: print symbolic gfp_flags in oom warning Vlastimil Babka
2015-12-18  9:03 ` [PATCH v3 09/14] mm, page_owner: print migratetype of page and pageblock, symbolic flags Vlastimil Babka
2016-01-07 10:06   ` Michal Hocko
2015-12-18  9:03 ` [PATCH v3 10/14] mm, page_owner: convert page_owner_inited to static key Vlastimil Babka
2016-01-07 10:21   ` Michal Hocko
2015-12-18  9:03 ` [PATCH v3 11/14] mm, page_owner: copy page owner info during migration Vlastimil Babka
2016-01-07 10:44   ` Michal Hocko
2015-12-18  9:03 ` [PATCH v3 12/14] mm, page_owner: track and print last migrate reason Vlastimil Babka
2016-01-07 10:54   ` Michal Hocko
2016-01-07 13:17     ` Vlastimil Babka
2015-12-18  9:03 ` [PATCH v3 13/14] mm, page_owner: dump page owner info from dump_page() Vlastimil Babka
2015-12-18  9:03 ` [PATCH v3 14/14] mm, debug: move bad flags printing to bad_page() Vlastimil Babka
2016-01-07 13:10   ` Michal Hocko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20160107095756.GF27868@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=acme@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=iamjoonsoo.kim@lge.com \
    --cc=kirill.shutemov@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mgorman@suse.de \
    --cc=minchan@kernel.org \
    --cc=mingo@redhat.com \
    --cc=peterz@infradead.org \
    --cc=rostedt@goodmis.org \
    --cc=sasha.levin@oracle.com \
    --cc=vbabka@suse.cz \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).