linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: David Rientjes <rientjes@google.com>
To: Vlastimil Babka <vbabka@suse.cz>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Michal Hocko <mhocko@kernel.org>,
	Johannes Weiner <hannes@cmpxchg.org>,
	Mel Gorman <mgorman@suse.de>,
	linux-mm@kvack.org, LKML <linux-kernel@vger.kernel.org>,
	Rasmus Villemoes <linux@rasmusvillemoes.dk>
Subject: Re: [patch] mm, oom: header nodemask is NULL when cpusets are disabled
Date: Fri, 20 Jan 2017 02:02:47 -0800 (PST)	[thread overview]
Message-ID: <alpine.DEB.2.10.1701200202001.88633@chino.kir.corp.google.com> (raw)
In-Reply-To: <e32b48f0-e345-2a44-9f95-0403eeb6a4fd@suse.cz>

On Fri, 20 Jan 2017, Vlastimil Babka wrote:

> Could we simplify both patches with something like this?
> Although the sizeof("null") is not the nicest thing, because it relies on knowledge
> that pointer() in lib/vsprintf.c uses this string. Maybe Rasmus has some better idea?
> 
> Thanks,
> Vlastimil
> 
> diff --git a/include/linux/nodemask.h b/include/linux/nodemask.h
> index f746e44d4046..4add88ef63f0 100644
> --- a/include/linux/nodemask.h
> +++ b/include/linux/nodemask.h
> @@ -103,7 +103,7 @@ extern nodemask_t _unused_nodemask_arg_;
>   *
>   * Can be used to provide arguments for '%*pb[l]' when printing a nodemask.
>   */
> -#define nodemask_pr_args(maskp)		MAX_NUMNODES, (maskp)->bits
> +#define nodemask_pr_args(maskp)		((maskp) ? MAX_NUMNODES : (int) sizeof("null")), ((maskp) ? (maskp)->bits : NULL)
>  
>  /*
>   * The inline keyword gives the compiler room to decide to inline, or
> 

That's creative.  I'm not sure if it's worth it considering 
nodemask_pr_args() is usually used in a context where we know we have a 
nodemask :)  These would be the only two exceptions.

--
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-20 10:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-18 21:51 [patch -mm] mm, page_alloc: warn_alloc " David Rientjes
2017-01-19  7:29 ` Vlastimil Babka
2017-01-19  8:57   ` Michal Hocko
2017-01-19 22:57   ` [patch] mm, oom: header " David Rientjes
2017-01-20  7:07     ` Hillf Danton
2017-01-20 10:00       ` [patch -mm] mm, oom: header nodemask is NULL when cpusets are disabled fix David Rientjes
2017-01-20  9:00     ` [patch] mm, oom: header nodemask is NULL when cpusets are disabled Vlastimil Babka
2017-01-20 10:02       ` David Rientjes [this message]
2017-01-24 10:12     ` 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=alpine.DEB.2.10.1701200202001.88633@chino.kir.corp.google.com \
    --to=rientjes@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=hannes@cmpxchg.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux@rasmusvillemoes.dk \
    --cc=mgorman@suse.de \
    --cc=mhocko@kernel.org \
    --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