linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
From: Zhenhua Huang <quic_zhenhuah@quicinc.com>
To: <akpm@linux-foundation.org>, <surenb@google.com>,
	<kent.overstreet@linux.dev>
Cc: <linux-kernel@vger.kernel.org>, <linux-mm@kvack.org>,
	Zhenhua Huang <quic_zhenhuah@quicinc.com>
Subject: [PATCH] mm/code_tag: Skip displaying the code_tag if it is not called
Date: Wed, 11 Dec 2024 16:56:16 +0800	[thread overview]
Message-ID: <20241211085616.2471901-1-quic_zhenhuah@quicinc.com> (raw)

/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@quicinc.com>
---
 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



             reply	other threads:[~2024-12-11  8:56 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11  8:56 Zhenhua Huang [this message]
2024-12-12  7:16 ` Suren Baghdasaryan
2024-12-12  7:50   ` Zhenhua Huang
2024-12-13  2:44     ` Suren Baghdasaryan
2024-12-13  3:51       ` Zhenhua Huang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241211085616.2471901-1-quic_zhenhuah@quicinc.com \
    --to=quic_zhenhuah@quicinc.com \
    --cc=akpm@linux-foundation.org \
    --cc=kent.overstreet@linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=surenb@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox