linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Michal Hocko <mhocko@kernel.org>
To: David Rientjes <rientjes@google.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Mel Gorman <mgorman@suse.de>, Vlastimil Babka <vbabka@suse.cz>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 2/4] mm, page_alloc: warn_alloc print nodemask
Date: Wed, 18 Jan 2017 11:10:06 +0100	[thread overview]
Message-ID: <20170118101006.GO7015@dhcp22.suse.cz> (raw)
In-Reply-To: <alpine.DEB.2.10.1701171459570.142998@chino.kir.corp.google.com>

On Tue 17-01-17 15:01:35, David Rientjes wrote:
> On Tue, 17 Jan 2017, Michal Hocko wrote:
> 
> > diff --git a/include/linux/mm.h b/include/linux/mm.h
> > index 57dc3c3b53c1..3e35eb04a28a 100644
> > --- a/include/linux/mm.h
> > +++ b/include/linux/mm.h
> > @@ -1912,8 +1912,8 @@ extern void si_meminfo_node(struct sysinfo *val, int nid);
> >  extern unsigned long arch_reserved_kernel_pages(void);
> >  #endif
> >  
> > -extern __printf(2, 3)
> > -void warn_alloc(gfp_t gfp_mask, const char *fmt, ...);
> > +extern __printf(3, 4)
> > +void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...);
> >  
> >  extern void setup_per_cpu_pageset(void);
> >  
> > diff --git a/mm/page_alloc.c b/mm/page_alloc.c
> > index 8f4f306d804c..7f9c0ee18ae0 100644
> > --- a/mm/page_alloc.c
> > +++ b/mm/page_alloc.c
> > @@ -3031,12 +3031,13 @@ static void warn_alloc_show_mem(gfp_t gfp_mask)
> >  	show_mem(filter);
> >  }
> >  
> > -void warn_alloc(gfp_t gfp_mask, const char *fmt, ...)
> > +void warn_alloc(gfp_t gfp_mask, nodemask_t *nodemask, const char *fmt, ...)
> >  {
> >  	struct va_format vaf;
> >  	va_list args;
> >  	static DEFINE_RATELIMIT_STATE(nopage_rs, DEFAULT_RATELIMIT_INTERVAL,
> >  				      DEFAULT_RATELIMIT_BURST);
> > +	nodemask_t *nm = (nodemask) ? nodemask : &cpuset_current_mems_allowed;
> 
> Small nit: wouldn't it be helpful to know if ac->nodemask is actually NULL 
> rather than setting it to cpuset_current_mems_allowed here?  We know the 
> effective nodemask from cpuset_print_current_mems_allowed(), but we don't 
> know if there's a bug in the page allocator which is failing to set 
> ac->nodemask appropriately if we blindly set it here when cpusets are not 
> enabled.

You are right that games with the nodemask are dangerous and can
potentially lead to unexpected behavior. I wanted to make this code as
simple as possible though and printing mems_allowed for NULL nodemask
looked like the way. Feel free to post a patch to handle null nodemask
in the output if you think it is an improvement.

-- 
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:[~2017-01-18 10:10 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-17  9:15 [PATCH 0/4 v2] show_mem updates Michal Hocko
2017-01-17  9:15 ` [PATCH 1/4] mm, page_alloc: do not report all nodes in show_mem Michal Hocko
2017-01-17  9:30   ` Hillf Danton
2017-01-17 22:55   ` David Rientjes
2017-01-17  9:15 ` [PATCH 2/4] mm, page_alloc: warn_alloc print nodemask Michal Hocko
2017-01-17  9:32   ` Hillf Danton
2017-01-17 23:01   ` David Rientjes
2017-01-18 10:10     ` Michal Hocko [this message]
2017-01-17  9:15 ` [PATCH 3/4] arch, mm: remove arch specific show_mem Michal Hocko
2017-01-17  9:15 ` [PATCH 4/4] lib/show_mem.c: teach show_mem to work with the given nodemask Michal Hocko
  -- strict thread matches above, loose matches on Subject: below --
2017-01-12 13:16 [PATCH 0/4] show_mem updates Michal Hocko
2017-01-12 13:16 ` [PATCH 2/4] mm, page_alloc: warn_alloc print nodemask Michal Hocko
2017-01-12 13:47   ` Mel Gorman
2017-01-13 11:31   ` Vlastimil Babka
2017-01-13 14:58     ` 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=20170118101006.GO7015@dhcp22.suse.cz \
    --to=mhocko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mgorman@suse.de \
    --cc=rientjes@google.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