]> www.infradead.org Git - users/willy/xarray.git/commitdiff
mm/show_mem.c: report alloc tags in human readable units
authorKent Overstreet <kent.overstreet@linux.dev>
Fri, 6 Sep 2024 00:53:37 +0000 (20:53 -0400)
committerAndrew Morton <akpm@linux-foundation.org>
Tue, 17 Sep 2024 08:07:00 +0000 (01:07 -0700)
We already do this when reporting slab info - more consistent and more
readable.

Link: https://lkml.kernel.org/r/20240906005337.1220091-1-kent.overstreet@linux.dev
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
Reviewed-by: Suren Baghdasaryan <surenb@google.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
mm/show_mem.c

index bdb439551eefcb6deb5c9f16a8b97db2873c1137..ec885a398fa09ed95222243d09a018eb8fa68c69 100644 (file)
@@ -435,15 +435,18 @@ void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx)
                                struct codetag *ct = tags[i].ct;
                                struct alloc_tag *tag = ct_to_alloc_tag(ct);
                                struct alloc_tag_counters counter = alloc_tag_read(tag);
+                               char bytes[10];
+
+                               string_get_size(counter.bytes, 1, STRING_UNITS_2, bytes, sizeof(bytes));
 
                                /* Same as alloc_tag_to_text() but w/o intermediate buffer */
                                if (ct->modname)
-                                       pr_notice("%12lli %8llu %s:%u [%s] func:%s\n",
-                                                 counter.bytes, counter.calls, ct->filename,
+                                       pr_notice("%12s %8llu %s:%u [%s] func:%s\n",
+                                                 bytes, counter.calls, ct->filename,
                                                  ct->lineno, ct->modname, ct->function);
                                else
-                                       pr_notice("%12lli %8llu %s:%u func:%s\n",
-                                                 counter.bytes, counter.calls, ct->filename,
+                                       pr_notice("%12s %8llu %s:%u func:%s\n",
+                                                 bytes, counter.calls, ct->filename,
                                                  ct->lineno, ct->function);
                        }
                }