lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251124101545.0250445c@gandalf.local.home>
Date: Mon, 24 Nov 2025 10:15:45 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: SeongJae Park <sj@...nel.org>
Cc: Andrew Morton <akpm@...ux-foundation.org>, Masami Hiramatsu
 <mhiramat@...nel.org>, Mathieu Desnoyers <mathieu.desnoyers@...icios.com>,
 damon@...ts.linux.dev, linux-kernel@...r.kernel.org, linux-mm@...ck.org,
 linux-trace-kernel@...r.kernel.org
Subject: Re: [RFC PATCH 12/12] mm/damon/core: add trace point for damos stat
 per apply interval

On Sun, 23 Nov 2025 10:43:26 -0800
SeongJae Park <sj@...nel.org> wrote:

> --- a/mm/damon/core.c
> +++ b/mm/damon/core.c
> @@ -2256,6 +2256,19 @@ static void damos_adjust_quota(struct damon_ctx *c, struct damos *s)
>  	quota->min_score = score;
>  }
>  
> +static void damos_trace_stat(struct damon_ctx *c, struct damos *s)
> +{
> +	unsigned int cidx = 0, sidx = 0;
> +	struct damos *siter;
> +
> +	damon_for_each_scheme(siter, c) {
> +		if (siter == s)
> +			break;
> +		sidx++;
> +	}
> +	trace_damos_stat_after_apply_interval(cidx, sidx, &s->stat);
> +}
> +
>  static void kdamond_apply_schemes(struct damon_ctx *c)
>  {
>  	struct damon_target *t;
> @@ -2294,6 +2307,8 @@ static void kdamond_apply_schemes(struct damon_ctx *c)
>  			(s->apply_interval_us ? s->apply_interval_us :
>  			 c->attrs.aggr_interval) / sample_interval;
>  		s->last_applied = NULL;
> +		if (trace_damos_stat_after_apply_interval_enabled())
> +			damos_trace_stat(c, s);
>  	}
>  	mutex_unlock(&c->walk_control_lock);
>  }


I wonder if the above would look better (and still produce good assembly)
if it was:

static inline void damos_trace_stat(struct damon_ctx *c, struct damos *s)
{
	unsigned int cidx = 0, sidx = 0;
	struct damos *siter;

	if (!trace_damos_stat_after_apply_interval_enabled())
		return;

	damon_for_each_scheme(siter, c) {
		if (siter == s)
			break;
		sidx++;
	}
	trace_damos_stat_after_apply_interval(cidx, sidx, &s->stat);
}

static void kdamond_apply_schemes(struct damon_ctx *c)
{
	struct damon_target *t;
> @@ -2294,6 +2307,8 @@ static void kdamond_apply_schemes(struct damon_ctx *c)
			(s->apply_interval_us ? s->apply_interval_us :
			 c->attrs.aggr_interval) / sample_interval;
 		s->last_applied = NULL;
		damos_trace_stat(c, s);
	}
	mutex_unlock(&c->walk_control_lock);
}


I have no real preference. I just think keeping the "if ()" statement out
of the main code as a more aesthetic look. But the above should be
equivalent in actual functionality.

-- Steve

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ