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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <6f372bce-151e-79e1-2fda-d8b2bcf777d6@linux.alibaba.com>
Date:   Sun, 12 Apr 2020 16:42:21 +0800
From:   Peng Wang <rocking@...ux.alibaba.com>
To:     mingo@...hat.com, peterz@...radead.org, juri.lelli@...hat.com,
        vincent.guittot@...aro.org, dietmar.eggemann@....com,
        rostedt@...dmis.org, bsegall@...gle.com, mgorman@...e.de
Cc:     linux-kernel@...r.kernel.org
Subject: Re: [PATCH] sched/fair: Simplify the code of should_we_balance()

On 4/11/20 5:20 PM, Peng Wang wrote:
> We only consider group_balance_cpu() after there is no idle
> cpu. So, just do comparison before return at these two cases.
> 
> Signed-off-by: Peng Wang <rocking@...ux.alibaba.com>
> ---
>   kernel/sched/fair.c | 16 +++++-----------
>   1 file changed, 5 insertions(+), 11 deletions(-)
> 
> diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c
> index 1ea3ddd..81b2c647 100644
> --- a/kernel/sched/fair.c
> +++ b/kernel/sched/fair.c
> @@ -9413,7 +9413,7 @@ static int active_load_balance_cpu_stop(void *data);
>   static int should_we_balance(struct lb_env *env)
>   {
>   	struct sched_group *sg = env->sd->groups;
> -	int cpu, balance_cpu = -1;
> +	int cpu;
>   
>   	/*
>   	 * Ensure the balancing environment is consistent; can happen
> @@ -9434,18 +9434,12 @@ static int should_we_balance(struct lb_env *env)
>   		if (!idle_cpu(cpu))
>   			continue;
>   
> -		balance_cpu = cpu;
> -		break;
> +		/* Are we the first idle CPU? */
> +		return cpu == env->dst_cpu;
>   	}
>   
> -	if (balance_cpu == -1)
> -		balance_cpu = group_balance_cpu(sg);
> -
> -	/*
> -	 * First idle CPU or the first CPU(busiest) in this sched group
> -	 * is eligible for doing load balancing at this and above domains.
> -	 */
> -	return balance_cpu == env->dst_cpu;
> +	/* Are we the first balance CPU of this group? */
> +	return group_balance_cpu(sg) == env->dst_cpu;
>   }
>   
>   /*
> 

+juri.lelli@...hat.com

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ