Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp6698149ybi; Mon, 8 Jul 2019 07:13:43 -0700 (PDT) X-Google-Smtp-Source: APXvYqxWAUdMRdVn1xQOCgQjSp5wxdsZMuRwDT7SZSVVwx6OMDjP8ALIVrljn/JxPlYk0dqkF0eP X-Received: by 2002:a17:90a:2305:: with SMTP id f5mr27205772pje.128.1562595223285; Mon, 08 Jul 2019 07:13:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1562595223; cv=none; d=google.com; s=arc-20160816; b=1GT/8Jwxy4V7XgLz9Ift2SAagAylGnyA4nsorGaNOqBhwmHqL2CteFBQL16To/Zybp mZwq8ZorzHGDJ5lJmj+z7I3e69otgKv0ejMBcZ4jGjzXsyvqrKGVTrlDxH+zqTBaEjQN wRwJe6LFeHhLrEUshmiGKYlEOXtf5/2h2kx/4/lw0E1YCyls0MvvoUVP1jdY2L0I/ee7 vTK4eCcWSwaz+4L3lU5o7KJ3r/OA7lMlPggQXwPOb1eCRAH/K1xLSKF60z7L0C55zPrD nlzxeRDsAV8AThwGNHnEl/25XhgPs0qxZ8EGiETSobtGUP64Q4Qsc0zeSEeqDgTrUlZl /Oyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=b5qXum5h7Vyhb39cf424pttg4JuuutBnFQzGHy3SShs=; b=eLbOcatm19CnAml3gJQqs1XQRSKJXPYnzZGmOLEd5edo2vmG+5hOljQ8ccg4WlNfqu LzC5ZGB/R9XF7ui1mqs5/GR04orPx4y6e+Y8wo/5qazHarufNh9wekGWNJ39e5n+OQuV lYjmLGrmxHA/uoLzIIDKkSflTUnAOOIR5qyMGJVTfS4wziG4RptpLwsjOI5oUWDIPJ7A CGWowBn7LW82jckTP27UXRa7dx7rUAp4WAkaOdT469iiILttatDpdzm+qKk5yWfQEQTB pOFo1sFboMeblMLClKv+BmvdPjSvKAlhtzKgbx5DL1M8anhSGy9H0AIExrlkPLEKxYcm FdbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=KyZlzWPd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i1si18064963pgq.13.2019.07.08.07.13.28; Mon, 08 Jul 2019 07:13:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=KyZlzWPd; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730011AbfGHKXW (ORCPT + 99 others); Mon, 8 Jul 2019 06:23:22 -0400 Received: from merlin.infradead.org ([205.233.59.134]:52528 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726962AbfGHKXW (ORCPT ); Mon, 8 Jul 2019 06:23:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=b5qXum5h7Vyhb39cf424pttg4JuuutBnFQzGHy3SShs=; b=KyZlzWPd7D/4gzRBgdm8VLXgU K+62TEoubYE1b1J6FkGbHpypbHekaei9FoyEi5oYZGtflDclFtFm8LyV9r4oXhxChHhwTveZLEsJY KT+tFKDc1ZjRZDdGVC+lBgSCQDTyMaqxYsCLxAV6HwWBGtlreeUTBynHYHfJRclIrgFFU9rOKrlwz lx/kWNxWpaHW4raCDJ+Q75F9liUEn9/a2CZRZBlFMKmcEeT9xAxVEEtx3tk55fKQdKzJpCLCLkiB7 ym6SZ9zDVVKkvzGVxIrBDw9xuN7Pb8lHHqKe5ZCcoh0Mj0+pqZqNNtWnx8r4P3JD2gfcN1HmiBLE/ fT1Dp5tTg==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.92 #3 (Red Hat Linux)) id 1hkQnh-0006Kk-I2; Mon, 08 Jul 2019 10:23:13 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 4BC7B20B28AD5; Mon, 8 Jul 2019 12:23:12 +0200 (CEST) Date: Mon, 8 Jul 2019 12:23:12 +0200 From: Peter Zijlstra To: Srikar Dronamraju Cc: Markus Elfring , kernel-janitors@vger.kernel.org, Ingo Molnar , LKML Subject: Re: [PATCH] sched/topology: One function call less in build_group_from_child_sched_domain() Message-ID: <20190708102312.GF3402@hirez.programming.kicks-ass.net> References: <20190706172223.GA12680@linux.vnet.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190706172223.GA12680@linux.vnet.ibm.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 06, 2019 at 10:52:23PM +0530, Srikar Dronamraju wrote: > * Markus Elfring [2019-07-06 16:05:17]: > > > From: Markus Elfring > > 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 > > --- > > 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).