Received: by 10.223.176.5 with SMTP id f5csp2055752wra; Thu, 8 Feb 2018 07:46:55 -0800 (PST) X-Google-Smtp-Source: AH8x224Jz5CnnQkz1H1xb8LInzVoGOFj6am1zuM77t6F6/5CSWWaBlgV2X2pw2npnIAPpGH6b5tA X-Received: by 2002:a17:902:7716:: with SMTP id n22-v6mr1029878pll.388.1518104815564; Thu, 08 Feb 2018 07:46:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518104815; cv=none; d=google.com; s=arc-20160816; b=Pa0XYYfVCMWw+Leu5bJ/D1rIaAjg38Fb6iuitdAliHBeTARDWFUhsnPw9N/e8ET3w/ IzNd4eXJEzqBvtYeYP9IOXCF0B3WkRFUON43dHMLT7q+lI3/AEKt/4DFnNiKkumUkgO7 axWqoxIhD7mnaUHhRx+CwuXMUKG0JRaj4bcUTxyCSrOQ4TIRPGzY/1xUL7T3EHyRuJQT Bso5MTDwij7WKiSpVbRfKC631Y8jnPgP153f8570uY8fneyjk/LZDpGaM7SxJG6Gdn9t NLPm5JraROEvAKgi+bhGkdvGwuTtwhRtjTQ6zM8ceVyAl/hQ5YeYDxP7/7B1k1GgI9ym Tdfw== 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=RsPwsMhwkCw7fbOjDGhz/LJSEyuons0DdFZ3xeNNHko=; b=pT44FVzWPstPDjtYLRY31PDS40aksZRDr8Y4wmkSjU0oN4Ny7scpXBw0ZCE5ii6iOn c1YoKk2/OtQ/igniHDLJTfQNM5+8OsWYG7w488o7p5WWpSGi1lQT1l0IDSyP/6z1XI8R iQXpfS/JrwqS4olLMnAkkRJqR2qF6z8lYHPVe08dsqq8zt6LeN0VFamxdupOp9AASy7x JmC8Y38pWshLfGkBQc5fsgE3NqgQHpcdOuAAgZUipGB0fgtTmlwR9oLjYMtZ9hK7uDns 5X1E1j2oY/Dr4oAom+VwnBQhnflr/qTUkXNY3cVBFnLmKByrnst1k4BUcLCFBsMHsIGP 2xlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=AlEStzIf; 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 e3si81948pgr.135.2018.02.08.07.46.40; Thu, 08 Feb 2018 07:46:55 -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=AlEStzIf; 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 S1752220AbeBHPpI (ORCPT + 99 others); Thu, 8 Feb 2018 10:45:08 -0500 Received: from merlin.infradead.org ([205.233.59.134]:47690 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752176AbeBHPpG (ORCPT ); Thu, 8 Feb 2018 10:45:06 -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=RsPwsMhwkCw7fbOjDGhz/LJSEyuons0DdFZ3xeNNHko=; b=AlEStzIfGEt4Xyflx4a/bYv8m Ce9JwWKuTRK6pUN+iSfsDRCG+jYsqNmYgd8JnUiiW6UxjL0GBXa0kefAZzEuDQkah5hX/gouarXwO xYJtMGBloXOXaO+LrTnBxZJpbIYahR2McuKqOorzgTWoWpGMH8offUNLfihP8st7OKOOjTm1ASvz1 9ktLzC/ISGSyrMIIeQceCjK+IwprpyMXtl6JuDnFXx/CKWyJZfypk33rkZMJLMcntaAjPJV6jSiz9 9qlfrzaf9+BVwC0WqLFDBvEutT1ZvEPL35mqXOBc+TFrIZICVODPf9UGyH1vw5HUW3xX7e4Rfkeg5 xmExeIuYg==; 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 1ejoNi-00026B-6H; Thu, 08 Feb 2018 15:45:02 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 5ABB020274D62; Thu, 8 Feb 2018 16:44:59 +0100 (CET) Date: Thu, 8 Feb 2018 16:44:59 +0100 From: Peter Zijlstra To: Vincent Guittot Cc: Ingo Molnar , linux-kernel , Valentin Schneider , Morten Rasmussen , Brendan Jackman , Dietmar Eggemann , Will Deacon Subject: Re: [PATCH v2 1/3] sched: Stop nohz stats when decayed Message-ID: <20180208154459.GA25181@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: 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 04:05:58PM +0100, Vincent Guittot wrote: > On 8 February 2018 at 15:00, 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; Should we not set that with rq->lock held? We already clear it while holding rq->lock. > >> + > >> if (rq->nohz_tick_stopped) > >> - return; > > > > this case is difficult... needs thinking > > The use case happens when a CPU wakes up and goes back to idle before > the tick fires and clears nohz_tick_stopped. Yes, and so we could have accrued blocked load. Now in this case the CPU must already be set in the cpumask, but we could've already cleared has_blocked. My question is mostly about needing that "goto out" to set the flag, because I think we can loose it on a store collision vs clearing it. But in that case I suppose the iteration must already be in progress, which in turn will observe rq->has_blocked_load and re-set nohz.has_blocked. So yes, this is good, but could use a comment. > > Without this ordering I think it would be possible to loose has_blocked > > and not observe the CPU either. > > I think that you are right. > I also wondered if some barriers were necessary but wrongly concluded > that set operation on nohz.idle_cpus_mask and WRITE_ONCE with volatile > would be enough to ensure the right ordering Yeah, so I forgot to write the comment in my patch, but it had the barriers implied by cmpxchg.