Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp518760pxu; Thu, 3 Dec 2020 06:17:28 -0800 (PST) X-Google-Smtp-Source: ABdhPJwNnPHZnyqD3BsILp1FFVs/2WaB211CGL3p8OJLqlJtTkvhPHpJ9wQlJDhW1FKFy9CgebcT X-Received: by 2002:a50:b002:: with SMTP id i2mr2992026edd.99.1607005047976; Thu, 03 Dec 2020 06:17:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607005047; cv=none; d=google.com; s=arc-20160816; b=rPimjBZa3VeTTngIPm98Bh2cBJ3EqxB6dK3sO+cJDQvVYKQxmexxnb8kuEarRdPCVI xbt9kDyKeh9pLB3g9MfRXR+xYN7BK28jcRlOFqd0aBNYtFxweHqwfQyHT2Sl4iiDQ0oT Kxa8ZgQvBow3pmi5UXEPKL6LS3mJ27cCppLRhE9K9wXn8ZwCrspnsGH+WweyL1Sz0alB YicAjRyvz6nTa67a3LebZ0XOSEQbywvb5PbmUYeFXW+7/klVZpuqYJLgpu0AHNFVKVbC IoKF3jXqQOhPnA1LABk+FfXUjvtg1Xz5m18m5l0rzfpvbjVN9/i5xryJaIgniFjIoLUn B71A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=hrPTnXFpgzPbOCH3jUdvuEG0hvrA13yENfnm6xeQzSU=; b=ENthZHwC3nbTw5wAH48jLPtstqDp01Zcu5gfBNyUWwTH7hjY/1U/VtFXpMQXiEpemY Q+A4Ugpr56Nb3dDEKiYv/t9WZvYmvgNBJvxVzCwaySUY4tWfgsfBUAHMzRgkMY3y5YwA Ha00PiGzrzKTp6gQBH06SUrInJR3mqgsHAPZ7iseEXrSJkvAtGFN/UcHeeNNqXDhM1pc SojKopqEntgNYeZTVhS4vCMB6Dn/xdSskmsgRZAZiMrSV/MeLJMK9guYg/tNhz24Am4X Z7AriedAmxkiQLJpkYyQJXJh3ZAzrPPG6CdH6BZZteVsGuutHV77zuRTvx8RrANu/BIr 0Sdg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id dk4si996130edb.455.2020.12.03.06.17.04; Thu, 03 Dec 2020 06:17:27 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2436639AbgLCOMf (ORCPT + 99 others); Thu, 3 Dec 2020 09:12:35 -0500 Received: from outbound-smtp61.blacknight.com ([46.22.136.249]:58567 "EHLO outbound-smtp61.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727984AbgLCOMR (ORCPT ); Thu, 3 Dec 2020 09:12:17 -0500 Received: from mail.blacknight.com (pemlinmail03.blacknight.ie [81.17.254.16]) by outbound-smtp61.blacknight.com (Postfix) with ESMTPS id 0DDA7FA901 for ; Thu, 3 Dec 2020 14:11:26 +0000 (GMT) Received: (qmail 22842 invoked from network); 3 Dec 2020 14:11:25 -0000 Received: from unknown (HELO stampy.112glenside.lan) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPA; 3 Dec 2020 14:11:25 -0000 From: Mel Gorman To: LKML Cc: Aubrey Li , Barry Song , Ingo Molnar , Peter Ziljstra , Juri Lelli , Vincent Guittot , Valentin Schneider , Linux-ARM , Mel Gorman Subject: [PATCH 06/10] sched/fair: Clear the target CPU from the cpumask of CPUs searched Date: Thu, 3 Dec 2020 14:11:20 +0000 Message-Id: <20201203141124.7391-7-mgorman@techsingularity.net> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201203141124.7391-1-mgorman@techsingularity.net> References: <20201203141124.7391-1-mgorman@techsingularity.net> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The target CPU is definitely not idle in both select_idle_core and select_idle_cpu. For select_idle_core(), the SMT is potentially checked unnecessarily as the core is definitely not idle if the target is busy. For select_idle_cpu(), the first CPU checked is simply a waste. Signed-off-by: Mel Gorman --- kernel/sched/fair.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 68dd9cd62fbd..1d8f5c4b4936 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6077,6 +6077,7 @@ static int select_idle_core(struct task_struct *p, struct sched_domain *sd, int return -1; cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr); + __cpumask_clear_cpu(target, cpus); for_each_cpu_wrap(core, cpus, target) { bool idle = true; @@ -6181,6 +6182,7 @@ static int select_idle_cpu(struct task_struct *p, struct sched_domain *sd, int t time = cpu_clock(this); cpumask_and(cpus, sched_domain_span(sd), p->cpus_ptr); + __cpumask_clear_cpu(target, cpus); for_each_cpu_wrap(cpu, cpus, target) { schedstat_inc(this_rq()->sis_scanned); -- 2.26.2