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


Groups > linux.kernel > #1346906 > unrolled thread

[PATCH mmotm] mm, sl[au]b: print gfp_flags as strings in slab_out_of_memory()

Started byVlastimil Babka <vbabka@suse.cz>
First post2016-03-01 20:10 +0100
Last post2016-03-02 15:20 +0100
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH mmotm] mm, sl[au]b: print gfp_flags as strings in slab_out_of_memory() Vlastimil Babka <vbabka@suse.cz> - 2016-03-01 20:10 +0100
    Re: [PATCH mmotm] mm, sl[au]b: print gfp_flags as strings in  slab_out_of_memory() David Rientjes <rientjes@google.com> - 2016-03-01 23:50 +0100
      Re: [PATCH mmotm] mm, sl[au]b: print gfp_flags as strings in  slab_out_of_memory() Vlastimil Babka <vbabka@suse.cz> - 2016-03-02 15:20 +0100

#1346906 — [PATCH mmotm] mm, sl[au]b: print gfp_flags as strings in slab_out_of_memory()

FromVlastimil Babka <vbabka@suse.cz>
Date2016-03-01 20:10 +0100
Subject[PATCH mmotm] mm, sl[au]b: print gfp_flags as strings in slab_out_of_memory()
Message-ID<r7XQf-4Tj-43@gated-at.bofh.it>
We can now print gfp_flags more human-readable. Make use of this in
slab_out_of_memory() for SLUB and SLAB. Also convert the SLAB variant it to
pr_warn() along the way.

Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
---
This could go after e.g. mm-oom-print-symbolic-gfp_flags-in-oom-warning.patch
Quick grep suggests there are no other places to convert.

 mm/slab.c | 10 ++++------
 mm/slub.c |  4 ++--
 2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/mm/slab.c b/mm/slab.c
index b9ee77554008..c87088ae2351 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -1347,10 +1347,9 @@ slab_out_of_memory(struct kmem_cache *cachep, gfp_t gfpflags, int nodeid)
 	if ((gfpflags & __GFP_NOWARN) || !__ratelimit(&slab_oom_rs))
 		return;
 
-	printk(KERN_WARNING
-		"SLAB: Unable to allocate memory on node %d (gfp=0x%x)\n",
-		nodeid, gfpflags);
-	printk(KERN_WARNING "  cache: %s, object size: %d, order: %d\n",
+	pr_warn("SLAB: Unable to allocate memory on node %d, gfp=%#x(%pGg)\n",
+		nodeid, gfpflags, &gfpflags);
+	pr_warn("  cache: %s, object size: %d, order: %d\n",
 		cachep->name, cachep->size, cachep->gfporder);
 
 	for_each_kmem_cache_node(cachep, node, n) {
@@ -1374,8 +1373,7 @@ slab_out_of_memory(struct kmem_cache *cachep, gfp_t gfpflags, int nodeid)
 
 		num_slabs += active_slabs;
 		num_objs = num_slabs * cachep->num;
-		printk(KERN_WARNING
-			"  node %d: slabs: %ld/%ld, objs: %ld/%ld, free: %ld\n",
+		pr_warn("  node %d: slabs: %ld/%ld, objs: %ld/%ld, free: %ld\n",
 			node, active_slabs, num_slabs, active_objs, num_objs,
 			free_objects);
 	}
diff --git a/mm/slub.c b/mm/slub.c
index d86720d93cda..8caaf2903241 100644
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -2248,8 +2248,8 @@ slab_out_of_memory(struct kmem_cache *s, gfp_t gfpflags, int nid)
 	if ((gfpflags & __GFP_NOWARN) || !__ratelimit(&slub_oom_rs))
 		return;
 
-	pr_warn("SLUB: Unable to allocate memory on node %d (gfp=0x%x)\n",
-		nid, gfpflags);
+	pr_warn("SLUB: Unable to allocate memory on node %d, gfp=%#x(%pGg)\n",
+		nid, gfpflags, &gfpflags);
 	pr_warn("  cache: %s, object size: %d, buffer size: %d, default order: %d, min order: %d\n",
 		s->name, s->object_size, s->size, oo_order(s->oo),
 		oo_order(s->min));
-- 
2.7.2

[toc] | [next] | [standalone]


#1347078 — Re: [PATCH mmotm] mm, sl[au]b: print gfp_flags as strings in slab_out_of_memory()

FromDavid Rientjes <rientjes@google.com>
Date2016-03-01 23:50 +0100
SubjectRe: [PATCH mmotm] mm, sl[au]b: print gfp_flags as strings in slab_out_of_memory()
Message-ID<r81h8-75L-3@gated-at.bofh.it>
In reply to#1346906
On Tue, 1 Mar 2016, Vlastimil Babka wrote:

> We can now print gfp_flags more human-readable. Make use of this in
> slab_out_of_memory() for SLUB and SLAB. Also convert the SLAB variant it to
> pr_warn() along the way.
> 
> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
> Cc: Christoph Lameter <cl@linux.com>
> Cc: Pekka Enberg <penberg@kernel.org>
> Cc: David Rientjes <rientjes@google.com>
> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>

Acked-by: David Rientjes <rientjes@google.com>

Although I've always been curious about the usefulness of these out of 
memory calls in the first place.  They are obviously for debugging, but 
have they actually helped to diagnose anything?

[toc] | [prev] | [next] | [standalone]


#1348065 — Re: [PATCH mmotm] mm, sl[au]b: print gfp_flags as strings in slab_out_of_memory()

FromVlastimil Babka <vbabka@suse.cz>
Date2016-03-02 15:20 +0100
SubjectRe: [PATCH mmotm] mm, sl[au]b: print gfp_flags as strings in slab_out_of_memory()
Message-ID<r8fN7-l3-17@gated-at.bofh.it>
In reply to#1347078
On 03/01/2016 11:41 PM, David Rientjes wrote:
> On Tue, 1 Mar 2016, Vlastimil Babka wrote:
>
>> We can now print gfp_flags more human-readable. Make use of this in
>> slab_out_of_memory() for SLUB and SLAB. Also convert the SLAB variant it to
>> pr_warn() along the way.
>>
>> Signed-off-by: Vlastimil Babka <vbabka@suse.cz>
>> Cc: Christoph Lameter <cl@linux.com>
>> Cc: Pekka Enberg <penberg@kernel.org>
>> Cc: David Rientjes <rientjes@google.com>
>> Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
>
> Acked-by: David Rientjes <rientjes@google.com>

Thanks.

> Although I've always been curious about the usefulness of these out of
> memory calls in the first place.  They are obviously for debugging, but
> have they actually helped to diagnose anything?

Uh no idea, maybe other SL*B maintainers have more experience. But what 
did prompt me to write this patch is that I've recently have actually 
seen the output of those in some (presumably linux-mm) thread.

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web