Received: by 10.223.176.5 with SMTP id f5csp1890576wra; Thu, 8 Feb 2018 05:17:42 -0800 (PST) X-Google-Smtp-Source: AH8x224Bt/wpytF2rr06gmdSiKFn1+ZPe30hIfvof5eSKjSRVuOGUfGu/wDVCsZ1EVzhvwQaP5S4 X-Received: by 10.99.39.1 with SMTP id n1mr499252pgn.155.1518095862791; Thu, 08 Feb 2018 05:17:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518095862; cv=none; d=google.com; s=arc-20160816; b=MEaY1nNkECT/rc8DypI7nOgkfdShiBsEIEy4qivXEAeurYlixoaH6F8OX2PEso4ry0 RoqcXPP/9B/jhwg1yaCBcRPqT2al0wZtsWw8NYISjma+5z/H9R2dUVDiLcGmTN6YqDQZ d2H2qDi9N8JRXGmxu0CaeXJX1wVGoKWBdFDVK9X4YQDQ2ceBxPdG75qdpVRufcBf3dxg nu49SxyD7YBGJdqxCg1rvzukdgRaG4jDUKhI457Sg/HxQYUA/bp0Jcs+6MMLvKulZYom zd3OZJN+cdFVCm4+1lqg2Zttv4T+7uMD9t6zXKfQXAdqMWGFo4aC2SJ48AKgjXQDCnHt 7fbQ== 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:dkim-signature:arc-authentication-results; bh=a+5xbx/4Q+EAZFS7K4vgKZ5iziSCAqCNFk/HFjOfvVc=; b=E1GtZZndJs0pKRMWIZroUfxZHya7iAMuhqmKye137lJRCcxjJlcCx/+Qir+kTe6Ait uPwcKTOGFdGP0nHUJt1tyOVWllen+DCvlDxDUifDdGWlR3DW/F5Dh3YWyPbl66ZO+kyF /SS7rhvAWNVd3yauwQ1vzfNAogZCr0L9IPcT9S9sJEsfPyHcMqHeQ/AEletRKVO+YN3I lKchiGTAwlPAoiRVMXyYCJ+ttwxBFmbxNttweb4zp7ja5aZI8b9tD/TMU3ilNEXJ2AbT XICOC8ks6ijyEBbQn3kQUZYTrX3NxFqVlC9WCo1WTWeyJfMlVFC5OSHFs8bvWdOJmXt3 OWbA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=MmJU86vN; 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 k82si1291039pfa.134.2018.02.08.05.17.29; Thu, 08 Feb 2018 05:17:42 -0800 (PST) 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; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=MmJU86vN; 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 S1752020AbeBHNPa (ORCPT + 99 others); Thu, 8 Feb 2018 08:15:30 -0500 Received: from merlin.infradead.org ([205.233.59.134]:46278 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751941AbeBHNP2 (ORCPT ); Thu, 8 Feb 2018 08:15:28 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=a+5xbx/4Q+EAZFS7K4vgKZ5iziSCAqCNFk/HFjOfvVc=; b=MmJU86vNy3pemt+33U8aAWUXx sDXPjOGFqivJDvmSKwrcWWTued7aQjEcAyVZK+khFVmhbQotEPizB8puO64IOElQNBM5Cmt9KUNWW +NlqI0qmfIAR19d9GCy3sqLxfafIBduGJ3BPo06ENbxzv4uLs8Xa8WFFz6k5X1mHHnDJsVYrSJbD8 VZNvZH4HvYtFyoz4DA3jbUO616j/ZESiGGLNl2pOrnFKVSnOJVGBXP7pXbr/nQUmueW9OFf6XObNP udsTRqrQ2QM4fzch/ggPAPoNkpOL3n8YYZrzdvcNCpixeEpxAw12pXqCx4ubwhu7sbUDKY16A9ntA U4jg1Vqyw==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by merlin.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1ejm2t-0001Vh-Sz; Thu, 08 Feb 2018 13:15:24 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 88EED20286FA8; Thu, 8 Feb 2018 14:15:22 +0100 (CET) Date: Thu, 8 Feb 2018 14:15:22 +0100 From: Peter Zijlstra To: Valentin Schneider Cc: Vincent Guittot , mingo@kernel.org, linux-kernel@vger.kernel.org, morten.rasmussen@foss.arm.com, brendan.jackman@arm.com, dietmar.eggemann@arm.com Subject: Re: [PATCH v2 1/3] sched: Stop nohz stats when decayed Message-ID: <20180208131522.GG25201@hirez.programming.kicks-ass.net> References: <1517944987-343-1-git-send-email-vincent.guittot@linaro.org> <1517944987-343-2-git-send-email-vincent.guittot@linaro.org> <780a5b3a-4829-4195-c8fd-95da27248a82@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <780a5b3a-4829-4195-c8fd-95da27248a82@arm.com> User-Agent: Mutt/1.9.2 (2017-12-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Feb 08, 2018 at 12:46:53PM +0000, Valentin Schneider wrote: > On 02/06/2018 07:23 PM, Vincent Guittot wrote: > > [...] > > @@ -7826,8 +7842,8 @@ static inline void update_sg_lb_stats(struct lb_env *env, > > for_each_cpu_and(i, sched_group_span(group), env->cpus) { > > struct rq *rq = cpu_rq(i); > > > > - if (env->flags & LBF_NOHZ_STATS) > > - update_nohz_stats(rq); > > + if ((env->flags & LBF_NOHZ_STATS) && update_nohz_stats(rq)) > > + env->flags |= LBF_NOHZ_AGAIN; > > > > /* Bias balancing toward cpus of our domain */ > > if (local_group) > > @@ -7979,18 +7995,15 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd > > struct sg_lb_stats *local = &sds->local_stat; > > struct sg_lb_stats tmp_sgs; > > int load_idx, prefer_sibling = 0; > > + int has_blocked = READ_ONCE(nohz.has_blocked); > > bool overload = false; > > > > if (child && child->flags & SD_PREFER_SIBLING) > > prefer_sibling = 1; > > > > #ifdef CONFIG_NO_HZ_COMMON > > - if (env->idle == CPU_NEWLY_IDLE) { > > + if (env->idle == CPU_NEWLY_IDLE && has_blocked) > > env->flags |= LBF_NOHZ_STATS; > > - > > - if (cpumask_subset(nohz.idle_cpus_mask, sched_domain_span(env->sd))) > > - nohz.next_stats = jiffies + msecs_to_jiffies(LOAD_AVG_PERIOD); > > - } > > #endif > > > > load_idx = get_sd_load_idx(env->sd, env->idle); > > @@ -8046,6 +8059,15 @@ static inline void update_sd_lb_stats(struct lb_env *env, struct sd_lb_stats *sd > > sg = sg->next; > > } while (sg != env->sd->groups); > > > > +#ifdef CONFIG_NO_HZ_COMMON > > + if ((env->flags & LBF_NOHZ_AGAIN) && > > + cpumask_subset(nohz.idle_cpus_mask, sched_domain_span(env->sd))) { > > + > > + WRITE_ONCE(nohz.next_blocked, > > + jiffies + msecs_to_jiffies(LOAD_AVG_PERIOD)); > > Here we push the stats update forward if we visited all the nohz CPUs but they > still have blocked load. IMO we should also clear the nohz.has_blocked flag > if we visited all the nohz CPUs and none had blocked load left. You can't, new cpu's can have joined the set. I used to detect that, but that requires atomic ops.