Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp3607684pxu; Mon, 30 Nov 2020 06:46:56 -0800 (PST) X-Google-Smtp-Source: ABdhPJzG8iUaPUm9zxvDHmpRMpz97H/j+r+ml2tSVpUzlj6AytFkHZsj4rzKAKj4zt0LIfMuSzIJ X-Received: by 2002:a19:8854:: with SMTP id k81mr8126071lfd.577.1606747615729; Mon, 30 Nov 2020 06:46:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606747615; cv=none; d=google.com; s=arc-20160816; b=bl8HYrrE4nwpigp/JwpgKlWhln2dOuGLxscI3E+CiB5p3WZnoib+sBteBjbPYgCZnh XHWqQuu8JmMjAyWHKVhGUjmQHZosQyCcRQNjoV9fge2lLi1mdiOFYiOtQUQdOd+rs/DI 65yjr86RdgFnXkhDjYHSl1aT2uR7PmvKUr+YRVJM8cnVcLKroDiJ+pS4LUIj6+wUUENq Nfyd2CPlQ3QRVJQFRXGhgjCxpvCO28j1cd9FepBJB7M3ytFfpAzAbz18NYPm0rm7RoSD KkFUqwEcBtJSDK+QW7euekhgY6usaSdyZxsKa8VoA75e5IW0A9SbY6ZKdYY95t7upGot Xc6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:cc:to:from:date; bh=H1CrTicrBrxvVX7zicr10Wsxl0jCs/wQWJJ1AftBKZY=; b=X/HJi05MxYtVHskgiRo+xlt9WHMo5LdWpdxzhH6wrVLqEb5g4I4IR2J563MvjuPXiT KmmSCMo0U7OWYg80GvlqFLprtTl32e7OFx3+i9/gfWZ8dPf/zp2GrTEnq4CXAbmLP+A8 B53FFt9MZfRWjSLmR0ptEoI5QjNgJW0GVzeEtT19DWAjInoZr+U3ux9YesRH/t4Nb0sK q3eNCdV2XbppxpjJffTbbN9JXYumtkvayU6pc/YjMydFsGruRK0hVP+DYPo9uAqxXxdG NcWhaOGN2aP3iZM92+MQKcSnKjXSdo27Vrhdt6Z8G/QAy/kBkTkrYqokQTZbgNvaaFwR 0vXQ== 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 t20si10151762ejd.719.2020.11.30.06.46.22; Mon, 30 Nov 2020 06:46:55 -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 S1727050AbgK3OlN (ORCPT + 99 others); Mon, 30 Nov 2020 09:41:13 -0500 Received: from outbound-smtp26.blacknight.com ([81.17.249.194]:50920 "EHLO outbound-smtp26.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725859AbgK3OlN (ORCPT ); Mon, 30 Nov 2020 09:41:13 -0500 Received: from mail.blacknight.com (pemlinmail01.blacknight.ie [81.17.254.10]) by outbound-smtp26.blacknight.com (Postfix) with ESMTPS id D152BCB011 for ; Mon, 30 Nov 2020 14:40:21 +0000 (GMT) Received: (qmail 28275 invoked from network); 30 Nov 2020 14:40:21 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.22.4]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 30 Nov 2020 14:40:21 -0000 Date: Mon, 30 Nov 2020 14:40:20 +0000 From: Mel Gorman To: Ingo Molnar , Peter Zijlstra Cc: Vincent Guittot , "Li, Aubrey" , Valentin Schneider , linux-kernel , Mel Gorman Subject: [PATCH] sched/fair: Clear SMT siblings after determining the core is not idle Message-ID: <20201130144020.GS3371@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The clearing of SMT siblings from the SIS mask before checking for an idle core is a small but unnecessary cost. Defer the clearing of the siblings until the scan moves to the next potential target. The cost of this was not measured as it is borderline noise but it should be self-evident. Signed-off-by: Mel Gorman --- kernel/sched/fair.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/kernel/sched/fair.c b/kernel/sched/fair.c index 0d54d69ba1a5..d9acd55d309b 100644 --- a/kernel/sched/fair.c +++ b/kernel/sched/fair.c @@ -6087,10 +6087,11 @@ static int select_idle_core(struct task_struct *p, struct sched_domain *sd, int break; } } - cpumask_andnot(cpus, cpus, cpu_smt_mask(core)); if (idle) return core; + + cpumask_andnot(cpus, cpus, cpu_smt_mask(core)); } /*