linux-trace-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: SeongJae Park <sj@kernel.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: SeongJae Park <sj@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	Masami Hiramatsu <mhiramat@kernel.org>,
	Mathieu Desnoyers <mathieu.desnoyers@efficios.com>,
	damon@lists.linux.dev, kernel-team@meta.com,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	linux-trace-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] mm/damon: add trace event for effective size quota
Date: Wed,  9 Jul 2025 11:28:43 -0700	[thread overview]
Message-ID: <20250709182843.35812-1-sj@kernel.org> (raw)
In-Reply-To: <20250709122123.779c874f@batman.local.home>

Hi Steven,

On Wed, 9 Jul 2025 12:21:23 -0400 Steven Rostedt <rostedt@goodmis.org> wrote:

> On Fri,  4 Jul 2025 15:14:08 -0700
> SeongJae Park <sj@kernel.org> wrote:
> 
> > Aim-oriented DAMOS quota auto-tuning is an important and recommended
> > feature for DAMOS users.  Add a trace event for the observability of the
> > tuned quota and tuning itself.
> > 
> > Signed-off-by: SeongJae Park <sj@kernel.org>
> > ---
> >  include/trace/events/damon.h | 26 ++++++++++++++++++++++++++
> >  mm/damon/core.c              | 20 +++++++++++++++++++-
> >  2 files changed, 45 insertions(+), 1 deletion(-)
> > 
> > diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h
> > index 32c611076023..36b2cdf47dce 100644
> > --- a/include/trace/events/damon.h
> > +++ b/include/trace/events/damon.h
> > @@ -9,6 +9,32 @@
> >  #include <linux/types.h>
> >  #include <linux/tracepoint.h>
> >  
> > +TRACE_EVENT_CONDITION(damos_esz,
> > +
> > +	TP_PROTO(unsigned int context_idx, unsigned int scheme_idx,
> > +		unsigned long esz, bool do_trace),
> > +
> > +	TP_ARGS(context_idx, scheme_idx, esz, do_trace),
> > +
> > +	TP_CONDITION(do_trace),
> 
> Please explain to me why you are using a conditional here?

There is no reason to make this conditional.  Maybe I was out of my mind.

[...]
> > --- a/mm/damon/core.c
> > +++ b/mm/damon/core.c
> > @@ -2011,12 +2011,26 @@ static void damos_set_effective_quota(struct damos_quota *quota)
> >  	quota->esz = esz;
> >  }
> >  
> > +static void damos_trace_esz(struct damon_ctx *c, struct damos *s,
> > +		struct damos_quota *quota)
> > +{
> > +	unsigned int cidx = 0, sidx;
> > +	struct damos *siter;
> > +
> > +	damon_for_each_scheme(siter, c) {
> > +		if (siter == s)
> > +			break;
> > +		sidx++;
> > +	}
> > +	trace_damos_esz(cidx, sidx, quota->esz, true);
> 
> It's set to true, so it's not even a conditional anymore. The compiler
> will likely optimize it out!

You're right.

Andrew, could you please add below fixup patch?


Thanks,
SJ

=================== >8 ======================
From 13975534cad603410837c5eca299f0a24ad802a1 Mon Sep 17 00:00:00 2001
From: SeongJae Park <sj@kernel.org>
Date: Wed, 9 Jul 2025 11:22:39 -0700
Subject: [PATCH] mm/damon: make damos_esz unconditional trace event

It has no reason to be conditional.  Make it unconditional trace event.

Fixes: 9a365a71b830 ("mm/damon: add trace event for effective size quota") # mm-unstable
Closes: https://lore.kernel.org/20250709122123.779c874f@batman.local.home
Reported-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: SeongJae Park <sj@kernel.org>
---
 include/trace/events/damon.h | 8 +++-----
 mm/damon/core.c              | 2 +-
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/include/trace/events/damon.h b/include/trace/events/damon.h
index 2e4d7d281fa7..fc2c61ccc887 100644
--- a/include/trace/events/damon.h
+++ b/include/trace/events/damon.h
@@ -9,14 +9,12 @@
 #include <linux/types.h>
 #include <linux/tracepoint.h>
 
-TRACE_EVENT_CONDITION(damos_esz,
+TRACE_EVENT(damos_esz,
 
 	TP_PROTO(unsigned int context_idx, unsigned int scheme_idx,
-		unsigned long esz, bool do_trace),
+		unsigned long esz),
 
-	TP_ARGS(context_idx, scheme_idx, esz, do_trace),
-
-	TP_CONDITION(do_trace),
+	TP_ARGS(context_idx, scheme_idx, esz),
 
 	TP_STRUCT__entry(
 		__field(unsigned int, context_idx)
diff --git a/mm/damon/core.c b/mm/damon/core.c
index 0f7d8b37c91d..775e097b6538 100644
--- a/mm/damon/core.c
+++ b/mm/damon/core.c
@@ -2223,7 +2223,7 @@ static void damos_trace_esz(struct damon_ctx *c, struct damos *s,
 			break;
 		sidx++;
 	}
-	trace_damos_esz(cidx, sidx, quota->esz, true);
+	trace_damos_esz(cidx, sidx, quota->esz);
 }
 
 static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
-- 
2.39.5


      reply	other threads:[~2025-07-09 18:28 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-04 22:14 [PATCH 0/2] mm/damon: add trace events for auto-tuned monitoring intervals and DAMOS quota SeongJae Park
2025-07-04 22:14 ` [PATCH 1/2] mm/damon: add trace event for auto-tuned monitoring intervals SeongJae Park
2025-07-04 22:14 ` [PATCH 2/2] mm/damon: add trace event for effective size quota SeongJae Park
2025-07-09 16:21   ` Steven Rostedt
2025-07-09 18:28     ` SeongJae Park [this message]

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=20250709182843.35812-1-sj@kernel.org \
    --to=sj@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=damon@lists.linux.dev \
    --cc=kernel-team@meta.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mhiramat@kernel.org \
    --cc=rostedt@goodmis.org \
    /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;
as well as URLs for NNTP newsgroup(s).