Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1563432

Re: [patch] mm, oom: header nodemask is NULL when cpusets are disabled

From David Rientjes <rientjes@google.com>
Newsgroups linux.kernel
Subject Re: [patch] mm, oom: header nodemask is NULL when cpusets are disabled
Date 2017-01-20 11:10 +0100
Message-ID <t1EiS-5VC-3@gated-at.bofh.it> (permalink)
References <t16qS-15L-41@gated-at.bofh.it> <t1fua-70y-13@gated-at.bofh.it> <t1tQt-7A8-1@gated-at.bofh.it> <t1Dwu-5pq-15@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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.

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[patch -mm] mm, page_alloc: warn_alloc nodemask is NULL when cpusets  are disabled David Rientjes <rientjes@google.com> - 2017-01-18 23:00 +0100
  Re: [patch -mm] mm, page_alloc: warn_alloc nodemask is NULL when  cpusets are disabled Vlastimil Babka <vbabka@suse.cz> - 2017-01-19 08:40 +0100
    Re: [patch -mm] mm, page_alloc: warn_alloc nodemask is NULL when  cpusets are disabled Michal Hocko <mhocko@kernel.org> - 2017-01-19 10:00 +0100
    [patch] mm, oom: header nodemask is NULL when cpusets are disabled David Rientjes <rientjes@google.com> - 2017-01-20 00:00 +0100
      Re: [patch] mm, oom: header nodemask is NULL when cpusets are disabled "Hillf Danton" <hillf.zj@alibaba-inc.com> - 2017-01-20 08:20 +0100
        [patch -mm] mm, oom: header nodemask is NULL when cpusets are disabled  fix David Rientjes <rientjes@google.com> - 2017-01-20 11:10 +0100
      Re: [patch] mm, oom: header nodemask is NULL when cpusets are  disabled Vlastimil Babka <vbabka@suse.cz> - 2017-01-20 10:20 +0100
        Re: [patch] mm, oom: header nodemask is NULL when cpusets are  disabled David Rientjes <rientjes@google.com> - 2017-01-20 11:10 +0100
      Re: [patch] mm, oom: header nodemask is NULL when cpusets are  disabled Michal Hocko <mhocko@kernel.org> - 2017-01-24 11:20 +0100

csiph-web