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=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,USER_AGENT_SANE_1 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 6A7EEC4338F for ; Wed, 4 Aug 2021 10:22:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4F95060EB2 for ; Wed, 4 Aug 2021 10:22:41 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237292AbhHDKWw (ORCPT ); Wed, 4 Aug 2021 06:22:52 -0400 Received: from outbound-smtp61.blacknight.com ([46.22.136.249]:33327 "EHLO outbound-smtp61.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235522AbhHDKWv (ORCPT ); Wed, 4 Aug 2021 06:22:51 -0400 Received: from mail.blacknight.com (pemlinmail05.blacknight.ie [81.17.254.26]) by outbound-smtp61.blacknight.com (Postfix) with ESMTPS id 0E485FAA38 for ; Wed, 4 Aug 2021 11:22:38 +0100 (IST) Received: (qmail 3488 invoked from network); 4 Aug 2021 10:22:37 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.17.255]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 4 Aug 2021 10:22:37 -0000 Date: Wed, 4 Aug 2021 11:22:36 +0100 From: Mel Gorman To: "Song Bao Hua (Barry Song)" Cc: LKML , Ingo Molnar , Peter Zijlstra , Vincent Guittot , Valentin Schneider , Aubrey Li , yangyicong Subject: Re: [PATCH 7/9] sched/fair: Enforce proportional scan limits when scanning for an idle core Message-ID: <20210804102236.GB6464@techsingularity.net> References: <20210726102247.21437-1-mgorman@techsingularity.net> <20210726102247.21437-8-mgorman@techsingularity.net> <58167022b9074ed9951b09ab6ba1983e@hisilicon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <58167022b9074ed9951b09ab6ba1983e@hisilicon.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Aug 02, 2021 at 10:52:01AM +0000, Song Bao Hua (Barry Song) wrote: > > @@ -6265,30 +6265,35 @@ static int select_idle_cpu(struct task_struct *p, struct > > sched_domain *sd, bool > > if (has_idle_core) { > > i = select_idle_core(p, cpu, cpus, &idle_cpu); > > if ((unsigned int)i < nr_cpumask_bits) > > - return i; > > + break; > > > > + nr -= sched_smt_weight; > > } else { > > - if (!--nr) > > - return -1; > > idle_cpu = __select_idle_cpu(cpu, p); > > if ((unsigned int)idle_cpu < nr_cpumask_bits) > > break; > > + nr--; > > } > > + > > + if (nr < 0) > > + break; > > } > > > > - if (has_idle_core) > > - set_idle_cores(target, false); > > + if ((unsigned int)idle_cpu < nr_cpumask_bits) { > > + if (has_idle_core) > > + set_idle_cores(target, false); > > > > For example, if we have 16 cpus(8 SMT2 cores). In case core7 is idle, > we only have scanned core0+core1(cpu0-cpu3) and if these two cores > are not idle, but here we set has_idle_cores to false while core7 is > idle. It seems incorrect. > Yep, that block needs to be revisited. -- Mel Gorman SUSE Labs