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=-20.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS 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 67D37C433E1 for ; Tue, 23 Mar 2021 15:09:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 459D5619C2 for ; Tue, 23 Mar 2021 15:09:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232649AbhCWPJu (ORCPT ); Tue, 23 Mar 2021 11:09:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57552 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232712AbhCWPJF (ORCPT ); Tue, 23 Mar 2021 11:09:05 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 950E8C061764; Tue, 23 Mar 2021 08:09:04 -0700 (PDT) Date: Tue, 23 Mar 2021 15:08:56 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1616512137; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XVbXEkiIHpyXN0C5ijWE4PRqcKypnI5p3HFpnBZ0Pgw=; b=My31Gb9xCbvgX60407o2PgiyfCXD9e8jxYjDmJi+BMqpXPMOsrOv1Fmi+scEWvQtmG7UJe j9zclEk1T8xLktkZw3GXesFqmO3zuF6aOxb7iZ15D4YUwAcUHMg38MUR4+cbQgz2z2Afts GuIj1l4FHXFOH+JJB7jOsQLHIU4O5Y4b6mLVR4BvP0rBPce7hg2d69wbls23aQ49gUq0Ze vxqU6TpPsw1OSP5pREILtIYInJwbsWSP3fIk+S/WkM9wmfaNuz3aKeHAnrimopKflkUG74 9Et5CKsEGEBcJt8T1LcQSJLs+Awix148OTWDnq/9RcdPLh27rZ+e928hAuc5+A== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1616512137; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XVbXEkiIHpyXN0C5ijWE4PRqcKypnI5p3HFpnBZ0Pgw=; b=RFWYTnQF7nXVCRCOmf3FmQ3HUBOLzSDcowGwEasVRde2/4TExwVeSlsiwh1kZ+HPqjYS/8 sVGFY4L9iRZlRSBg== From: "tip-bot2 for Barry Song" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: sched/core] sched/fair: Optimize test_idle_cores() for !SMT Cc: Barry Song , "Peter Zijlstra (Intel)" , Vincent Guittot , Mel Gorman , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20210320221432.924-1-song.bao.hua@hisilicon.com> References: <20210320221432.924-1-song.bao.hua@hisilicon.com> MIME-Version: 1.0 Message-ID: <161651213699.398.5893410671090085517.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the sched/core branch of tip: Commit-ID: c8987ae5af793a73e2c0d6ce804d8ff454ea377c Gitweb: https://git.kernel.org/tip/c8987ae5af793a73e2c0d6ce804d8ff454ea377c Author: Barry Song AuthorDate: Sun, 21 Mar 2021 11:14:32 +13:00 Committer: Peter Zijlstra CommitterDate: Tue, 23 Mar 2021 16:01:59 +01:00 sched/fair: Optimize test_idle_cores() for !SMT 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. This can 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 !SMT machines. Hackbench is ran with -g {2..14}, for each g it is ran 10 times to get an average. $ numactl -N 0 hackbench -p -T -l 20000 -g $1 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 Signed-off-by: Peter Zijlstra (Intel) Reviewed-by: Vincent Guittot Acked-by: Mel Gorman Link: https://lkml.kernel.org/r/20210320221432.924-1-song.bao.hua@hisilicon.com --- 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 6aad028..aaa0dfa 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; }