Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp737759pxu; Thu, 3 Dec 2020 11:18:40 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCHYTbF5pjq/EvLD2JicIaDibDResMjbnNdiyiNXanR4yeGwAPdxciPH95Sy8XWjDwJ3Ji X-Received: by 2002:a50:bc04:: with SMTP id j4mr4350483edh.316.1607023120181; Thu, 03 Dec 2020 11:18:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1607023120; cv=none; d=google.com; s=arc-20160816; b=tBH9lqCK9mrQO54mgltu64uRC7QDHwaAGga6pceQVZAfOtLkhZHmJbo0KJDard9UkQ hBY2hXggScjJOTCDAIQty8OTtoSTTbYA41Jia5g2ZBvLUdvGB81KGBfXlhleL0lygRs9 i03hMEKAWAYXYzNWFQqW6pEHahili1g+7kAJA+G9PJQLrHXjHipJuc66X4ea/0hkZPkq T1nxH9JS/RXkyWsJnGjwrmSY2cU4VrfQztn64EbTZNgGg7QYRa9t776VZkUWI9dQtAC9 tYleu/CtEXK0LoE5fhC+8ZWtqMek4H6YLaYtjXKUafCwT3E7TuvyuDqOQ/YR9o8hmsd7 DEeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=Ltl78lXBp6dDmBs0fVAnPQcvErbEe3OvqJPVj/xbjGU=; b=FcdFZTSSjMC49bc06NPlXnYc3A3/zZLOIH4baWRhjK/rPGCMEMPxcU6FJwZM1lWA17 /AHuZMaX51dUf+Lg+8DxiigQlDv0Tr1+aycopVhdNY7CM/lKK+zhPPShBAWH4x2OVELY fombELzZaOJUXmGCuafln7Y+tzVnJfA+mwMex97c8kcAEHvy+QDyleCXA+acBfMqtLUs 7EeTFTuYB4JkY0blfT7lzgjpzcYzwzzmmwZV4zEjD9SGrZnyBgDFTsMU8pgjIxIOrwSg oGgnL9AgaCeJwQzt88gGDQnZb2ahKXJAP6akgyzT4WmlzQ5zUuAmLhqRL0XJTkslqhH3 b74Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=WcZ349jz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u22si876283ejt.406.2020.12.03.11.18.16; Thu, 03 Dec 2020 11:18:40 -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; dkim=pass header.i=@linaro.org header.s=google header.b=WcZ349jz; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728090AbgLCQi5 (ORCPT + 99 others); Thu, 3 Dec 2020 11:38:57 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726751AbgLCQi5 (ORCPT ); Thu, 3 Dec 2020 11:38:57 -0500 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D35EAC061A51 for ; Thu, 3 Dec 2020 08:38:16 -0800 (PST) Received: by mail-lj1-x243.google.com with SMTP id a1so1899089ljq.3 for ; Thu, 03 Dec 2020 08:38:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=Ltl78lXBp6dDmBs0fVAnPQcvErbEe3OvqJPVj/xbjGU=; b=WcZ349jzBAd4ARpLKEAfsqIlphpKxcnW9E0gmPYxvdz8HhlTyf6ySmzEd40J6XRAed BlWswIs6POszFdZ9lDw57mCQQyX8CfMaIHKjaWkOFNLpVZOoGCfI9kyC942fNIKxSBUs I23qXIu1TL9Rh+T5Fznypo7sl3DuvSZCerz2pNcqcCW51WUGwlPiH65DjzN5wPUCE+7m SDGBEdzDJSSMBCIL+/AFhL5PW5OUwMiWyS6+dQcft+dH6SCa2cilPcquznqvF2U6zy8S mHNE/Kkh833e1XrHpeTsXKmKIbtB/oPr3GKZ/cYkJR3Z9YDydxK6YSm2yW1Os51628fs 2qPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ltl78lXBp6dDmBs0fVAnPQcvErbEe3OvqJPVj/xbjGU=; b=OYDoaY4n4o+om0Kz7Xigowwvv3aiFoVBaTsYooDMl9fLkU+7v7cGbQMsnPukPRLWPA 4GRkM3Ca5LYIKS+PqROkNCmxFlFEHgPfE6kbAYqlwXEAfXbPICQPZSZnA1yr8U5ecOYp L9v85xSCG1iYx02Fmcihe+dWzUDDwpE34/Lzk+pltKgVIjyn1b4XtXwThvNAm67PBCyY 0wtI+lIhU+WbDoeA8Ng0PyyeiGv3M7foRiA2wsu/Cqluy9mbamCm+EhM/HmYfSzYwSK4 y1jl3X+rvuj6oi1qMyxwSp2iZOX3W+sCYcHWj7IJVx42hHvGP61u9ep552wbQaZ7KFTc bAog== X-Gm-Message-State: AOAM533gcnYj0C9oqeQwBAv+DZI+FydXSk3hB6kCdCcDJwEdZZ2p0YWT En+fJaItnpZ5vaf5U8PzxP8Fe1y6Ohue+zsJixWelg== X-Received: by 2002:a2e:8050:: with SMTP id p16mr1589474ljg.69.1607013495295; Thu, 03 Dec 2020 08:38:15 -0800 (PST) MIME-Version: 1.0 References: <20201203141124.7391-1-mgorman@techsingularity.net> <20201203141124.7391-7-mgorman@techsingularity.net> In-Reply-To: <20201203141124.7391-7-mgorman@techsingularity.net> From: Vincent Guittot Date: Thu, 3 Dec 2020 17:38:03 +0100 Message-ID: Subject: Re: [PATCH 06/10] sched/fair: Clear the target CPU from the cpumask of CPUs searched To: Mel Gorman Cc: LKML , Aubrey Li , Barry Song , Ingo Molnar , Peter Ziljstra , Juri Lelli , Valentin Schneider , Linux-ARM Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 3 Dec 2020 at 15:11, Mel Gorman wrote: > > 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); should clear cpu_smt_mask(target) as we are sure that the core will not be idle > > 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 >