lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 20 Jan 2017 10:00:06 +0100
From:   Vlastimil Babka <vbabka@...e.cz>
To:     David Rientjes <rientjes@...gle.com>,
        Andrew Morton <akpm@...ux-foundation.org>
Cc:     Michal Hocko <mhocko@...nel.org>,
        Johannes Weiner <hannes@...xchg.org>,
        Mel Gorman <mgorman@...e.de>, linux-mm@...ck.org,
        LKML <linux-kernel@...r.kernel.org>,
        Rasmus Villemoes <linux@...musvillemoes.dk>
Subject: Re: [patch] mm, oom: header nodemask is NULL when cpusets are
 disabled

On 01/19/2017 11:57 PM, David Rientjes wrote:
> Commit 82e7d3abec86 ("oom: print nodemask in the oom report") implicitly 
> sets the allocation nodemask to cpuset_current_mems_allowed when there is 
> no effective mempolicy.  cpuset_current_mems_allowed is only effective 
> when cpusets are enabled, which is also printed by dump_header(), so 
> setting the nodemask to cpuset_current_mems_allowed is redundant and 
> prevents debugging issues where ac->nodemask is not set properly in the 
> page allocator.
> 
> This provides better debugging output since 
> cpuset_print_current_mems_allowed() is already provided.
> 
> Suggested-by: Vlastimil Babka <vbabka@...e.cz>
> Signed-off-by: David Rientjes <rientjes@...gle.com>
> ---
>  mm/oom_kill.c | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/mm/oom_kill.c b/mm/oom_kill.c
> --- a/mm/oom_kill.c
> +++ b/mm/oom_kill.c
> @@ -403,12 +403,14 @@ static void dump_tasks(struct mem_cgroup *memcg, const nodemask_t *nodemask)
>  
>  static void dump_header(struct oom_control *oc, struct task_struct *p)
>  {
> -	nodemask_t *nm = (oc->nodemask) ? oc->nodemask : &cpuset_current_mems_allowed;
> -
> -	pr_warn("%s invoked oom-killer: gfp_mask=%#x(%pGg), nodemask=%*pbl, order=%d, oom_score_adj=%hd\n",
> -		current->comm, oc->gfp_mask, &oc->gfp_mask,
> -		nodemask_pr_args(nm), oc->order,
> -		current->signal->oom_score_adj);
> +	pr_warn("%s invoked oom-killer: gfp_mask=%#x(%pGg), nodemask=",
> +		current->comm, oc->gfp_mask, &oc->gfp_mask);
> +	if (oc->nodemask)
> +		pr_cont("%*pbl", nodemask_pr_args(oc->nodemask));
> +	else
> +		pr_cont("(null)\n");
> +	pr_cont(",  order=%d, oom_score_adj=%hd\n",
> +		oc->order, current->signal->oom_score_adj);
>  	if (!IS_ENABLED(CONFIG_COMPACTION) && oc->order)
>  		pr_warn("COMPACTION is disabled!!!\n");
>  
> @@ -417,7 +419,7 @@ static void dump_header(struct oom_control *oc, struct task_struct *p)
>  	if (oc->memcg)
>  		mem_cgroup_print_oom_info(oc->memcg, p);
>  	else
> -		show_mem(SHOW_MEM_FILTER_NODES, nm);
> +		show_mem(SHOW_MEM_FILTER_NODES, oc->nodemask);
>  	if (sysctl_oom_dump_tasks)
>  		dump_tasks(oc->memcg, oc->nodemask);
>  }
> 

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ