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: <65dedcbc-aefb-eb30-39e1-194248214369@metux.net>
Date:   Mon, 8 Jul 2019 11:38:58 +0200
From:   "Enrico Weigelt, metux IT consult" <lkml@...ux.net>
To:     Srikar Dronamraju <srikar@...ux.vnet.ibm.com>,
        Markus Elfring <Markus.Elfring@....de>
Cc:     kernel-janitors@...r.kernel.org, Ingo Molnar <mingo@...hat.com>,
        Peter Zijlstra <peterz@...radead.org>,
        LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sched/topology: One function call less in
 build_group_from_child_sched_domain()

On 06.07.19 19:22, Srikar Dronamraju wrote:
> * Markus Elfring <Markus.Elfring@....de> [2019-07-06 16:05:17]:
> 
>> From: Markus Elfring <elfring@...rs.sourceforge.net>
>> Date: Sat, 6 Jul 2019 16:00:13 +0200
>>
>> Avoid an extra function call by using a ternary operator instead of
>> a conditional statement.
>>
>> This issue was detected by using the Coccinelle software.
>>
>> Signed-off-by: Markus Elfring <elfring@...rs.sourceforge.net>
>> ---
>>  kernel/sched/topology.c | 6 +-----
>>  1 file changed, 1 insertion(+), 5 deletions(-)
>>
>> diff --git a/kernel/sched/topology.c b/kernel/sched/topology.c
>> index f751ce0b783e..6190eb52c30a 100644
>> --- a/kernel/sched/topology.c
>> +++ b/kernel/sched/topology.c
>> @@ -886,11 +886,7 @@ build_group_from_child_sched_domain(struct sched_domain *sd, int cpu)
>>  		return NULL;
>>
>>  	sg_span = sched_group_span(sg);
>> -	if (sd->child)
>> -		cpumask_copy(sg_span, sched_domain_span(sd->child));
>> -	else
>> -		cpumask_copy(sg_span, sched_domain_span(sd));
>> -
>> +	cpumask_copy(sg_span, sched_domain_span(sd->child ? sd->child : sd));
> 
> At runtime, Are we avoiding a function call?
> However I think we are avoiding a branch instead of a conditional, which may
> be beneficial.

If you're assuming the compiler doesn't already optimize that (no idea
whether gcc really does that).

@Markus: could you check what gcc is actually generating out of both the
old and your new version ?


--mtx

-- 
Enrico Weigelt, metux IT consult
Free software and Linux embedded engineering
info@...ux.net -- +49-151-27565287

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ