]> git.ipfire.org Git - thirdparty/kernel/stable.git/blobdiff - mm/show_mem.c
Merge tag 'mm-stable-2024-05-17-19-19' of git://git.kernel.org/pub/scm/linux/kernel...
[thirdparty/kernel/stable.git] / mm / show_mem.c
index 8dcfafbd283c12a9f7ea1ad5b338848d9897a651..bdb439551eefcb6deb5c9f16a8b97db2873c1137 100644 (file)
@@ -423,4 +423,30 @@ void __show_mem(unsigned int filter, nodemask_t *nodemask, int max_zone_idx)
 #ifdef CONFIG_MEMORY_FAILURE
        printk("%lu pages hwpoisoned\n", atomic_long_read(&num_poisoned_pages));
 #endif
+#ifdef CONFIG_MEM_ALLOC_PROFILING
+       {
+               struct codetag_bytes tags[10];
+               size_t i, nr;
+
+               nr = alloc_tag_top_users(tags, ARRAY_SIZE(tags), false);
+               if (nr) {
+                       pr_notice("Memory allocations:\n");
+                       for (i = 0; i < nr; i++) {
+                               struct codetag *ct = tags[i].ct;
+                               struct alloc_tag *tag = ct_to_alloc_tag(ct);
+                               struct alloc_tag_counters counter = alloc_tag_read(tag);
+
+                               /* 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,
+                                                 ct->lineno, ct->modname, ct->function);
+                               else
+                                       pr_notice("%12lli %8llu %s:%u func:%s\n",
+                                                 counter.bytes, counter.calls, ct->filename,
+                                                 ct->lineno, ct->function);
+                       }
+               }
+       }
+#endif
 }