Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp949940ybb; Fri, 20 Mar 2020 10:44:55 -0700 (PDT) X-Google-Smtp-Source: ADFU+vsrajvQLZCngKYEMM8rYNmuJK7PR7t70YnBAtsRqW4yivNf8xETkq0A1g2SSZMhyx+0CYfX X-Received: by 2002:a9d:138:: with SMTP id 53mr7894159otu.67.1584726294848; Fri, 20 Mar 2020 10:44:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584726294; cv=none; d=google.com; s=arc-20160816; b=d48J3p18OGP6xRLuhIBkRDnSgene46URwNxmi1wuPV7W1IshRAp7TqnajLBe1/Eu3c JIrJInpCc1UOvPk44baw16cAYg8+zxD83JwflHqePw1PrPVbc9Q3u1ZnpxJYJiftrT71 /C+SpkuwSVkrkouzkC71uV3Mlv/9KRRhqzSHV3dz1XzM9OwoKVRHeckm9yy+glHBuxtb SH+R7C1UvQrRZJzSUcUibYW9YGsYtcvD0362xaiVvSFo0e6HXQaSUQs2ibUE0ui5sEvR VNa77wrQ6zVHTZaI546bc+qhjKfTuLQXZfNhKBHB6YePGisD/++bjElYqkqG7ETl/Jkk lqdA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=7vezUE7BKClhvFMB48TDUurceZFo2SbYxJhkxMfMx/0=; b=MIZ2HLK60MVfMABmAbrzGngIwCvzhZwwE5sImIJkStAiw/R5wrs9P+IWhnCoc9BYCM b8sv58ubyT6bazZ1TvF16INkYfPWrEM78TkFaBnK8iFxr1mTPYWvOEwNPVbQK/gfsBjo SfsuvcnT94XrrExa7Cny1d8MnbqpeCLF5c+bUROOLWaZduPDrH/bvF6OMIBSicRtY8RH IFMUZflc2zHd+5P0WXq1tTWxkG6V9YfaNbiqjKP2X2yghAOl6DDwiPfE0UDxc+T8ZRNj rnywdRIvvtdc28uB4cPN9MzXoQ3KPwfTnmZ6WATMiYYkvU/JdS+NghhJ3IepEMfPx9/4 NkJA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id l24si3346948otd.199.2020.03.20.10.44.41; Fri, 20 Mar 2020 10:44:54 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727226AbgCTRnK (ORCPT + 99 others); Fri, 20 Mar 2020 13:43:10 -0400 Received: from outbound-smtp04.blacknight.com ([81.17.249.35]:39483 "EHLO outbound-smtp04.blacknight.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726974AbgCTRnJ (ORCPT ); Fri, 20 Mar 2020 13:43:09 -0400 Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp04.blacknight.com (Postfix) with ESMTPS id B5E5CBEBC0 for ; Fri, 20 Mar 2020 17:43:06 +0000 (GMT) Received: (qmail 24761 invoked from network); 20 Mar 2020 17:43:06 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.18.57]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 20 Mar 2020 17:43:06 -0000 Date: Fri, 20 Mar 2020 17:43:04 +0000 From: Mel Gorman To: Vincent Guittot Cc: Ingo Molnar , Peter Zijlstra , Valentin Schneider , Phil Auld , LKML Subject: Re: [PATCH 4/4] sched/fair: Track possibly overloaded domains and abort a scan if necessary Message-ID: <20200320174304.GF3818@techsingularity.net> References: <20200320151245.21152-1-mgorman@techsingularity.net> <20200320151245.21152-5-mgorman@techsingularity.net> <20200320164432.GE3818@techsingularity.net> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Mar 20, 2020 at 05:54:57PM +0100, Vincent Guittot wrote: > On Fri, 20 Mar 2020 at 17:44, Mel Gorman wrote: > > > > On Fri, Mar 20, 2020 at 04:48:39PM +0100, Vincent Guittot wrote: > > > > --- > > > > include/linux/sched/topology.h | 1 + > > > > kernel/sched/fair.c | 65 +++++++++++++++++++++++++++++++++++++++--- > > > > kernel/sched/features.h | 3 ++ > > > > 3 files changed, 65 insertions(+), 4 deletions(-) > > > > > > > > diff --git a/include/linux/sched/topology.h b/include/linux/sched/topology.h > > > > index af9319e4cfb9..76ec7a54f57b 100644 > > > > --- a/include/linux/sched/topology.h > > > > +++ b/include/linux/sched/topology.h > > > > @@ -66,6 +66,7 @@ struct sched_domain_shared { > > > > atomic_t ref; > > > > atomic_t nr_busy_cpus; > > > > int has_idle_cores; > > > > + int is_overloaded; > > > > > > Can't nr_busy_cpus compared to sd->span_weight give you similar status ? > > > > > > > It's connected to nohz balancing and I didn't see how I could use that > > for detecting overload. Also, I don't think it ever can be larger than > > the sd weight and overload is based on the number of running tasks being > > greater than the number of available CPUs. Did I miss something obvious? > > IIUC you try to estimate if there is a chance to find an idle cpu > before starting the loop and scanning the domain and abort early if > the possibility is low. > > if nr_busy_cpus equals to sd->span_weight it means that there is no > free cpu so there is no need to scan > Ok, I see what you are getting at but I worry there are multiple problems there. First, the nr_busy_cpus is decremented only when a CPU is entering idle with the tick stopped. If nohz is disabled then this breaks, no? Secondly, a CPU can be idle but the tick not stopped if __tick_nohz_idle_stop_tick knows there is an event in the near future so using busy_cpus, we potentially miss a sibling that was adequate for running a task. Finally, the threshold for cutting off the search entirely seems low. The patch marks a domain as overloaded if there are twice as many running tasks as runqueues scanned. In that scenario, even if tasks are rapidly switching between busy/idle, it's still unlikely the task will go idle. When cutting off at just the fully-busy mark, we could miss a CPU that is going idle, almost idle or is running SCHED_IDLE tasks where are acceptable target candidates for select_idle_sibling. I think there are too many cases where nr_busy_cpus are problematic to make it a good alternative. -- Mel Gorman SUSE Labs