Received: by 10.223.176.5 with SMTP id f5csp1937074wra; Thu, 8 Feb 2018 06:02:49 -0800 (PST) X-Google-Smtp-Source: AH8x227iiQ/odmvrMq9HETYGu/hiC49EpBjd7iQCMG+cE50XAFPZKa2Q3UUu0V0J4q2rrk8zrbT6 X-Received: by 2002:a17:902:507:: with SMTP id 7-v6mr763746plf.0.1518098569672; Thu, 08 Feb 2018 06:02:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518098569; cv=none; d=google.com; s=arc-20160816; b=Z3IYgSmKTISfvE5nvt8RpuIphyC1OVlatzU23JRSOJ0BOp7AFbCmXYeaQm+0fAOKqs vLYTv8997+RcuPQYNWv5GpzrBgGx7mj1Cr1wC+9x+kpna1RgwI3vPVTVcUwmrz13wlft GHQR8ZkYeyzljTxuKcLDS/C2LLaW7dBL6MKe3/kqFugVUTDpO6PgwOWEUrLdQ277aHhz ugFL6khp+Hn2jZcTdrqNzPFpbZl8pmENqAqXRf9tQYpGHfGKOjrLgZRVoxixstZrW3dF 3iIffvp2v418coDhsVZhngKcOPFzoIvQ+dzYnEIzf/7UMRErXwuYH4LtNYBqg9GvvNZA VcAg== 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=2bxB/AgluIC9A3wBeQ1GdAJ0Y++TpqK/ITacaRMp974=; b=j6X3oB3D0SJiOVZ4vo9OCQ+3+hU7ekv1X3gGNNbQt+NYXqQRocBhIvCmQyMOImtdlR fM/rRgdJy6AwnD72XBRugjib9YlHL82xUNDCj8Nn0eLhnP+VQ87kXuRVt6+yvV7FuWNs d3vqWTvAuAUHwnFkn0N50BzClP7PnqlY3sr5+8i4DDbSGKkE04hbYhGvnBk1WzIDHWuQ WI7/vT5mzQYEopJHaDvK7710hxfsnqW8ZkGp9MT4UcLIdIha6vbs4pwV0wL3kkaz4kWj 5v5vWl4OPHAXYM2BYtc3ZCmUygr7Td6l7SVzxQbwejDVt1pv1I913iJhMDF6VSt5EKS5 QtKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=x2NT9zQr; 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 w62si354pgd.573.2018.02.08.06.02.31; Thu, 08 Feb 2018 06:02:49 -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=x2NT9zQr; 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 S1752212AbeBHOAP (ORCPT + 99 others); Thu, 8 Feb 2018 09:00:15 -0500 Received: from merlin.infradead.org ([205.233.59.134]:46646 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751130AbeBHOAO (ORCPT ); Thu, 8 Feb 2018 09:00:14 -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=2bxB/AgluIC9A3wBeQ1GdAJ0Y++TpqK/ITacaRMp974=; b=x2NT9zQreofxXg6H73L8L0p39 tLtlxGJrHVqs7689XJ+JN4PcCF6bbTZg2zn2IMZ4e1lFq/TcQ14OPiPVbZABAEqb77rupgYYeqfL8 3WMrleGCL8t+72E6uqmoQ58Xa2fAs9kgsytcKE2/SaqumQcUIQkIWAcwRS3lYgswBYTnjSl4G8Nhj w3X8v75tMKgQzi5N/lFae0V4khHRULnqmmaux5cAitdXEozvcKcBlkulbpjKJjXAhGM87qKMaulvo VogbHWV5F4hdp4WqApWbv+XaRXHuEwyQjqiCVDuRjcNLUOiuDj3qOFF4wGSegkLiP20il255YZYhG s8lhakEQw==; 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 1ejmkB-0001el-I3; Thu, 08 Feb 2018 14:00:07 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id EB38920274D63; Thu, 8 Feb 2018 15:00:05 +0100 (CET) Date: Thu, 8 Feb 2018 15:00:05 +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: <20180208140005.GH25201@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> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1517944987-343-2-git-send-email-vincent.guittot@linaro.org> 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 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.