From: Peter Zijlstra <peterz@infradead.org>
To: Srikar Dronamraju <srikar@linux.vnet.ibm.com>
Cc: Markus Elfring <Markus.Elfring@web.de>,
kernel-janitors@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] sched/topology: One function call less in build_group_from_child_sched_domain()
Date: Mon, 8 Jul 2019 12:23:12 +0200 [thread overview]
Message-ID: <20190708102312.GF3402@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <20190706172223.GA12680@linux.vnet.ibm.com>
On Sat, Jul 06, 2019 at 10:52:23PM +0530, Srikar Dronamraju wrote:
> * Markus Elfring <Markus.Elfring@web.de> [2019-07-06 16:05:17]:
>
> > From: Markus Elfring <elfring@users.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@users.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.
It all depends on what the compiler does; also this is super slow path
stuff and the patch makes code less readable (IMO).
next prev parent reply other threads:[~2019-07-08 10:23 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-07-06 14:05 [PATCH] sched/topology: One function call less in build_group_from_child_sched_domain() Markus Elfring
2019-07-06 17:22 ` Srikar Dronamraju
2019-07-08 9:38 ` Enrico Weigelt, metux IT consult
2019-07-08 14:27 ` Srikar Dronamraju
2019-07-08 10:23 ` Peter Zijlstra [this message]
2019-07-08 14:07 ` Srikar Dronamraju
2019-07-08 15:44 ` Markus Elfring
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=20190708102312.GF3402@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--cc=Markus.Elfring@web.de \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=srikar@linux.vnet.ibm.com \
/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).