[PATCH] mm/code_tag: Skip displaying the code_tag if it is not called
From: Zhenhua Huang
Date: Wed Dec 11 2024 - 03:56:59 EST
/proc/allocinfo is full of callsites which are not called at all.
Let's only output if the callsite actually been invoked.
Signed-off-by: Zhenhua Huang <quic_zhenhuah@xxxxxxxxxxx>
---
lib/alloc_tag.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/lib/alloc_tag.c b/lib/alloc_tag.c
index 35f7560a309a..06fb7eb5c0bc 100644
--- a/lib/alloc_tag.c
+++ b/lib/alloc_tag.c
@@ -95,10 +95,12 @@ static void alloc_tag_to_text(struct seq_buf *out, struct codetag *ct)
struct alloc_tag_counters counter = alloc_tag_read(tag);
s64 bytes = counter.bytes;
- seq_buf_printf(out, "%12lli %8llu ", bytes, counter.calls);
- codetag_to_text(out, ct);
- seq_buf_putc(out, ' ');
- seq_buf_putc(out, '\n');
+ if (bytes || counter.calls) {
+ seq_buf_printf(out, "%12lli %8llu ", bytes, counter.calls);
+ codetag_to_text(out, ct);
+ seq_buf_putc(out, ' ');
+ seq_buf_putc(out, '\n');
+ }
}
static int allocinfo_show(struct seq_file *m, void *arg)
--
2.25.1