Received: by 10.223.176.5 with SMTP id f5csp1941329wra; Thu, 8 Feb 2018 06:05:56 -0800 (PST) X-Google-Smtp-Source: AH8x226nycGPZ/ZdLkYerLTHb63SjbG3dBRQOLsmXytkKOpchUAceC2RYHAgCLw6gGHBkBdeX4oZ X-Received: by 2002:a17:902:43e4:: with SMTP id j91-v6mr734562pld.153.1518098756680; Thu, 08 Feb 2018 06:05:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518098756; cv=none; d=google.com; s=arc-20160816; b=JEcHP9QF1bwtkBUgx83DrO+EzLqNehjYXaV71U+Qt51WlMWjT6J81GJHDrUJ+/jpO8 E+3ZOH2T6e4qUiiD5p7Mo1vBj3PJ6SdY0E9MyvBQfvx/DAkE3vAuVS64f4nyRA/ABlmO xvFU2HCTjB8AZc4SvV9/oya5apLvYtXHugC9OLLqnBQvAH0n3gKQlGZ+kz+HAANR7Ib4 AjnyyxsgRvn/kTwA5m/1gl4e/Nx5Y8GG7h4lQ7Xn3RkIFczIRXCcfdmtZRIq2wsuCSn4 oE7IqmJHwnicQkZgxOMv2VTb3CGugNWi2uteULY1j/7CzWxiauIG/g7SXQpaQ2fZyZTj r11g== 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=w8YoZfGbP5+Kfa3eYWJOMiLOMjXIiTQ8GlT4u32cn1w=; b=meX3G1WBmBQQcvnLngS1k8RW62oVizHjr1IP3kPraV2vyRjOb1Ify0dMRuuPJtHB2S lKIiIMJMB2mqTouln94su1fA4pkIY9+Lv7H2qud7RmkHYjhB638V/U1IJqe9B0+cP/qC OXZ6DZ1nUl1fFigzbiVcySU2nBdzpzn+KWNkAUzmeanprDgGWD1ccAI3QLzL3M7VYxP2 Xkxh31VTL/U8ZjCZNsg2zx9ldj06cNW071ojjaVt2XV6QERPPwvPovDQujOmLwh1DJyl xCmW7C/2AfbadAbY6gvt9e6OKTQZyQdDWrWkOy+3JV5etmIyJCODy/DdqDub3BEVbuk4 mEkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=EMw+BtzB; 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 g6-v6si12213pll.488.2018.02.08.06.05.42; Thu, 08 Feb 2018 06:05:56 -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=bombadil.20170209 header.b=EMw+BtzB; 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 S1752316AbeBHOE1 (ORCPT + 99 others); Thu, 8 Feb 2018 09:04:27 -0500 Received: from bombadil.infradead.org ([65.50.211.133]:34691 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751079AbeBHOEX (ORCPT ); Thu, 8 Feb 2018 09:04:23 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.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=w8YoZfGbP5+Kfa3eYWJOMiLOMjXIiTQ8GlT4u32cn1w=; b=EMw+BtzBP+w4nR2RALioW9veH xPZJdPwB55GPy+5PgyWRoHW1X9nHGBTvo7TbXhVKAp0Xm4nzFlukV823+6dNyeQdIkFwQ0yUMxDem ++xu31Afc2vLmvOhBp8NLIFHGHLZwgpsAkL9zN0ewbHbLx+bU5SnZeZAk3rcS+jhvicjpHq2pJN9c nc6ROmW9ijfMeKzaRFzWRK0sXyuW9PJw1WN1gM9xGd8llhhwVaXmc3kGa4Nt1sKuElbY2PeHXNSMK EyqFI+TxdJqjCkjpAsFOt1uJh+FBb9Ci8ZlZjDANSI+3z0Gtj70BbDN8zQREqweliLNJ0L4l38bvF aP41MKtYQ==; Received: from j217100.upc-j.chello.nl ([24.132.217.100] helo=hirez.programming.kicks-ass.net) by bombadil.infradead.org with esmtpsa (Exim 4.89 #1 (Red Hat Linux)) id 1ejmoH-00079f-N0; Thu, 08 Feb 2018 14:04:21 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id E0D3920274D63; Thu, 8 Feb 2018 15:04:18 +0100 (CET) Date: Thu, 8 Feb 2018 15:04:18 +0100 From: Peter Zijlstra To: Vincent Guittot Cc: mingo@kernel.org, linux-kernel@vger.kernel.org, valentin.schneider@arm.com, morten.rasmussen@foss.arm.com, brendan.jackman@arm.com, dietmar.eggemann@arm.com, Will Deacon Subject: Re: [PATCH v2 1/3] sched: Stop nohz stats when decayed Message-ID: <20180208140418.GG25235@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> <20180208140005.GH25201@hirez.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180208140005.GH25201@hirez.programming.kicks-ass.net> 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 03:00:05PM +0100, Peter Zijlstra wrote: > On Tue, Feb 06, 2018 at 08:23:05PM +0100, Vincent Guittot wrote: > > > @@ -9207,13 +9231,15 @@ void nohz_balance_enter_idle(int cpu) > > if (!housekeeping_cpu(cpu, HK_FLAG_SCHED)) > > return; > > > > + rq->has_blocked_load = 1; > > + > > if (rq->nohz_tick_stopped) > > - return; > > this case is difficult... needs thinking > > > + goto out; > > > > /* > > * If we're a completely isolated CPU, we don't play. > > */ > > - if (on_null_domain(cpu_rq(cpu))) > > + if (on_null_domain(rq)) > > return; > > > > rq->nohz_tick_stopped = 1; > > @@ -9222,6 +9248,13 @@ void nohz_balance_enter_idle(int cpu) > > atomic_inc(&nohz.nr_cpus); > > > > set_cpu_sd_state_idle(cpu); > > /* > * Ensures that if nohz_idle_balance() fails to observe our > * @idle_cpus_mask store, it must observe the @has_blocked > * store. > */ > smp_mb__after_atomic(); > > > + > > +out: > > + /* > > + * Each time a cpu enter idle, we assume that it has blocked load and > > + * enable the periodic update of the load of idle cpus > > + */ > > + WRITE_ONCE(nohz.has_blocked, 1); > > } > > > > > @@ -9374,6 +9407,16 @@ static bool nohz_idle_balance(struct rq *this_rq, enum cpu_idle_type idle) > > > > SCHED_WARN_ON((flags & NOHZ_KICK_MASK) == NOHZ_BALANCE_KICK); > > > > + /* > > + * We assume there will be no idle load after this update and clear > > + * the has_blocked flag. If a cpu enters idle in the mean time, it will > > + * set the has_blocked flag and trig another update of idle load. > > + * Because a cpu that becomes idle, is added to idle_cpus_mask before > > + * setting the flag, we are sure to not clear the state and not > > + * check the load of an idle cpu. > > + */ > > + WRITE_ONCE(nohz.has_blocked, 0); > > /* > * Ensures that if we miss the CPU, we must see the has_blocked > * store from nohz_balance_enter_idle(). > */ > smp_mb(); > > > for_each_cpu(balance_cpu, nohz.idle_cpus_mask) { > > if (balance_cpu == this_cpu || !idle_cpu(balance_cpu)) > > continue; > > > I _think_, but my brain isn't quite willing to turn on today. > > Without this ordering I think it would be possible to loose has_blocked > and not observe the CPU either. > > might be the exact case from litmus-tests/R+mbonceonces.litmus but I can't seem to get herd7 working today.