From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-19.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3BD13C433C1 for ; Mon, 22 Mar 2021 05:10:38 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id C306361934 for ; Mon, 22 Mar 2021 05:10:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C306361934 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=hisilicon.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References:Message-ID:Date: Subject:CC:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eImT6Y6aiaDgSWmqVcyztIVmwmF53hHAVhSeaOWiznM=; b=OO4dj3WRv+tvy3u9I4lhhVv80 9+g0bz4EMEaKqDTO6jBHdXgaTPa7wVWW0/2HGW/KbjvWuqzhEdCZ2XFqm0ABepawhrUmS3HYlFumu XhZq0QJqbcd/v0jK2T7CcpgYqaWwOWK6sbO6vU60CEbY7vdbxKkrW1XTNnZVK7TOyZN9DxTyyQ06d wbI1CivxElZ2Y9AbR8x/1C3C3vibMdAAv/RHFqjbny6Z5tZII7YzlMd29ZEVq5UP/O60BgHhox3TG LJq6/k7wNbL4f7l/xSnA6EqFCuidK9UhT3jfOp/KuyU5Zoa+NR+fqYV9mEFXgpmN6wEEJtswV0bsU 7hk1Meudw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOCo7-00Auvb-AE; Mon, 22 Mar 2021 05:08:52 +0000 Received: from szxga03-in.huawei.com ([45.249.212.189]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOCnu-00Autc-Dg for linux-arm-kernel@lists.infradead.org; Mon, 22 Mar 2021 05:08:43 +0000 Received: from DGGEML404-HUB.china.huawei.com (unknown [172.30.72.56]) by szxga03-in.huawei.com (SkyGuard) with ESMTP id 4F3jBQ2hWsz5WZB; Mon, 22 Mar 2021 13:05:50 +0800 (CST) Received: from dggema721-chm.china.huawei.com (10.3.20.85) by DGGEML404-HUB.china.huawei.com (10.3.17.39) with Microsoft SMTP Server (TLS) id 14.3.498.0; Mon, 22 Mar 2021 13:08:18 +0800 Received: from dggemi761-chm.china.huawei.com (10.1.198.147) by dggema721-chm.china.huawei.com (10.3.20.85) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2106.2; Mon, 22 Mar 2021 13:08:18 +0800 Received: from dggemi761-chm.china.huawei.com ([10.9.49.202]) by dggemi761-chm.china.huawei.com ([10.9.49.202]) with mapi id 15.01.2106.013; Mon, 22 Mar 2021 13:08:18 +0800 From: "Song Bao Hua (Barry Song)" To: "Li, Aubrey" , "vincent.guittot@linaro.org" , "mingo@redhat.com" , "peterz@infradead.org" , "juri.lelli@redhat.com" , "dietmar.eggemann@arm.com" , "rostedt@goodmis.org" , "bsegall@google.com" , "mgorman@suse.de" CC: "valentin.schneider@arm.com" , "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , "xuwei (O)" , "Zengtao (B)" , "guodong.xu@linaro.org" , yangyicong , "Liguozhu (Kenneth)" , "linuxarm@openeuler.org" Subject: RE: [Linuxarm] Re: [PATCH] sched/fair: remove redundant test_idle_cores for non-smt Thread-Topic: [Linuxarm] Re: [PATCH] sched/fair: remove redundant test_idle_cores for non-smt Thread-Index: AQHXHddXuHcs+4JUY0qe6RO3UWlyCqqO6BUAgACMBHA= Date: Mon, 22 Mar 2021 05:08:18 +0000 Message-ID: References: <20210320221432.924-1-song.bao.hua@hisilicon.com> <5da632c1-382f-5c23-531e-98899cbe1abb@linux.intel.com> In-Reply-To: <5da632c1-382f-5c23-531e-98899cbe1abb@linux.intel.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.126.203.249] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210322_050840_826484_36B3DC3D X-CRM114-Status: GOOD ( 29.99 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > -----Original Message----- > From: Li, Aubrey [mailto:aubrey.li@linux.intel.com] > Sent: Monday, March 22, 2021 5:37 PM > To: Song Bao Hua (Barry Song) ; > vincent.guittot@linaro.org; mingo@redhat.com; peterz@infradead.org; > juri.lelli@redhat.com; dietmar.eggemann@arm.com; rostedt@goodmis.org; > bsegall@google.com; mgorman@suse.de > Cc: valentin.schneider@arm.com; linux-arm-kernel@lists.infradead.org; > linux-kernel@vger.kernel.org; xuwei (O) ; Zengtao (B) > ; guodong.xu@linaro.org; yangyicong > ; Liguozhu (Kenneth) ; > linuxarm@openeuler.org > Subject: [Linuxarm] Re: [PATCH] sched/fair: remove redundant test_idle_cores > for non-smt > > Hi Barry, > > On 2021/3/21 6:14, Barry Song wrote: > > update_idle_core() is only done for the case of sched_smt_present. > > but test_idle_cores() is done for all machines even those without > > smt. > > The patch looks good to me. > May I know for what case we need to keep CONFIG_SCHED_SMT for non-smt > machines? Hi Aubrey, I think the defconfig of arm64 has always enabled CONFIG_SCHED_SMT: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/arch/arm64/configs/defconfig it is probably true for x86 as well. I don't think Linux distribution will build a separate kernel for machines without smt. so basically the kernel depends on runtime topology parse to figure out if smt is present rather than depending on a rebuild. > > Thanks, > -Aubrey > > > > this could contribute to up 8%+ hackbench performance loss on a > > machine like kunpeng 920 which has no smt. this patch removes the > > redundant test_idle_cores() for non-smt machines. > > > > we run the below hackbench with different -g parameter from 2 to > > 14, for each different g, we run the command 10 times and get the > > average time: > > $ numactl -N 0 hackbench -p -T -l 20000 -g $1 > > > > hackbench will report the time which is needed to complete a certain > > number of messages transmissions between a certain number of tasks, > > for example: > > $ numactl -N 0 hackbench -p -T -l 20000 -g 10 > > Running in threaded mode with 10 groups using 40 file descriptors each > > (== 400 tasks) > > Each sender will pass 20000 messages of 100 bytes > > > > The below is the result of hackbench w/ and w/o this patch: > > g= 2 4 6 8 10 12 14 > > w/o: 1.8151 3.8499 5.5142 7.2491 9.0340 10.7345 12.0929 > > w/ : 1.8428 3.7436 5.4501 6.9522 8.2882 9.9535 11.3367 > > +4.1% +8.3% +7.3% +6.3% > > > > Signed-off-by: Barry Song > > --- > > kernel/sched/fair.c | 8 +++++--- > > 1 file changed, 5 insertions(+), 3 deletions(-) > > > > diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c > > index 2e2ab1e..de42a32 100644 > > --- a/kernel/sched/fair.c > > +++ b/kernel/sched/fair.c > > @@ -6038,9 +6038,11 @@ static inline bool test_idle_cores(int cpu, bool def) > > { > > struct sched_domain_shared *sds; > > > > - sds = rcu_dereference(per_cpu(sd_llc_shared, cpu)); > > - if (sds) > > - return READ_ONCE(sds->has_idle_cores); > > + if (static_branch_likely(&sched_smt_present)) { > > + sds = rcu_dereference(per_cpu(sd_llc_shared, cpu)); > > + if (sds) > > + return READ_ONCE(sds->has_idle_cores); > > + } > > > > return def; > > } Thanks Barry _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel