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] [day] [month] [year] [list]
Message-ID: <20241218114003.GL11133@noisy.programming.kicks-ass.net>
Date: Wed, 18 Dec 2024 12:40:03 +0100
From: Peter Zijlstra <peterz@...radead.org>
To: Swapnil Sapkal <swapnil.sapkal@....com>
Cc: mingo@...hat.com, juri.lelli@...hat.com, vincent.guittot@...aro.org,
	corbet@....net, dietmar.eggemann@....com, rostedt@...dmis.org,
	bsegall@...gle.com, mgorman@...e.de, vschneid@...hat.com,
	iamjoonsoo.kim@....com, qyousef@...alina.io, sshegde@...ux.ibm.com,
	alexs@...nel.org, lukasz.luba@....com, gautham.shenoy@....com,
	kprateek.nayak@....com, ravi.bangoria@....com,
	linux-kernel@...r.kernel.org, doc@...r.kernel.org
Subject: Re: [PATCH 3/6] sched: Report the different kinds of imbalances in
 /proc/schedstat

On Wed, Dec 18, 2024 at 04:36:26AM +0000, Swapnil Sapkal wrote:

> +static void update_lb_imbalance_stat(struct lb_env *env, struct sched_domain *sd,
> +				     enum cpu_idle_type idle)
> +{
> +	switch (env->migration_type) {
> +	case migrate_load:
> +		schedstat_add(sd->lb_imbalance_load[idle], env->imbalance);
> +		break;
> +	case migrate_util:
> +		schedstat_add(sd->lb_imbalance_util[idle], env->imbalance);
> +		break;
> +	case migrate_task:
> +		schedstat_add(sd->lb_imbalance_task[idle], env->imbalance);
> +		break;
> +	case migrate_misfit:
> +		schedstat_add(sd->lb_imbalance_misfit[idle], env->imbalance);
> +		break;
> +	}
> +}


Can you please write that like:

	if (!schedstat_enabled())
		return;

	switch () {
	case ...
		__schedstat_add();
	}

It makes no sense to have 4 copies of schedstat_enabled() inside the
switch statement -- esp. since afaik the compilers aren't able to CSE
static keys :/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ