Received: by 10.223.176.5 with SMTP id f5csp2128095wra; Thu, 8 Feb 2018 08:53:31 -0800 (PST) X-Google-Smtp-Source: AH8x226WlGS5Wupyo1tLBIqNTCybSuqd1CK/vxf/qisbvNMqfqSOAiDXprpNtTkXTBAN8iqKKlzs X-Received: by 2002:a17:902:868f:: with SMTP id g15-v6mr1215266plo.137.1518108811067; Thu, 08 Feb 2018 08:53:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518108811; cv=none; d=google.com; s=arc-20160816; b=cOYlmDqqgC614Ky8lVxY+kRwMDGl8ue+GNya8zD9iSIk8qGrtTzPSDrlvOajX6aA8I jmtx/O+0utIf64xbyEgXNmGl9jBc5xfMBpl2LBXJECmT4he3/6h/RELbuJt1b3/I2cFh 6UcT9sW3sbq2sisW52jA5wQzgcWydT/KcdF4xIf4V41owCYzlS1MLiJETSQ+pHweine1 wBfuo1d5YxAFm6uchMc7+U8jqR1eDP2A34nE71lLYqfYBTuvDs9AP9NaxRRLVVmRLate 9Pv8BVQQvR/6YJyxfrokHYA0Q6V4a78fqVERsLWthEGmIPI7W+ML43te00o70hxGKp// wNNA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=AYCvImsoOFA9902IvYRtUiYPRfP/FvoWK20Sdchlzos=; b=O0hMT/6CCxM3sCen14rtJSvXs+XTyNlUzksg7Atu6/s3Swv2TWf+JijqTnszL/lJXa SsWh+qW1liROrJzOIHUflGgcxcEEo6qoOB0UnQohOcyHmciLR6SyCPxm3VNHAPLvHXmJ ettWtja5xCxuWPWFwxisHslPWUJU1cvaRC3d9SARAVZip/y3CkW/syGvmjeX/1N4xQlC s0OXGx3WJGnVtqDJWFuaJDcCn+Ydc+uFB6z0JpEEkHJzeBq1ClTxNDeF9NwI/mxBX8ux ORIY8BFYwDzI7pH7Bilr3xkNVK6CR9Drdgkt/LvwVfgnZ8+NIhov8vflNGDZm6FJ3Fh3 FWTw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=gF91zK3d; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n65si227494pfg.219.2018.02.08.08.53.15; Thu, 08 Feb 2018 08:53:31 -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=pass header.i=@linaro.org header.s=google header.b=gF91zK3d; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752111AbeBHQwY (ORCPT + 99 others); Thu, 8 Feb 2018 11:52:24 -0500 Received: from mail-io0-f196.google.com ([209.85.223.196]:43373 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750847AbeBHQwW (ORCPT ); Thu, 8 Feb 2018 11:52:22 -0500 Received: by mail-io0-f196.google.com with SMTP id 72so6477934iom.10 for ; Thu, 08 Feb 2018 08:52:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=AYCvImsoOFA9902IvYRtUiYPRfP/FvoWK20Sdchlzos=; b=gF91zK3d/jZER2nrW6G3WcQvQLa4N3g2eyHhm/AqhpakLbbuqa9OQgH+WkIqXIQTK9 E8X6YPiBgcVC6xT3xdZOMLJvOm9AeiuxF29jn8/JcJ43A04Gxq0RhxJeMEJFV/InC9my /JYPOSqhHASZurFFiRjx2RcNnifNWsXkLvTc8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=AYCvImsoOFA9902IvYRtUiYPRfP/FvoWK20Sdchlzos=; b=g6ZqUBR0hnCO7TqEXFKxDgkO4rVGoC5ZT95OxLcwl1E/pqlbSOeU4xGUPUo8p2Om+1 ItPnph5F06RPZ+H/A7tvhIELEc/ocg5y0cHp290ypujNzGmOj/0hZUETeyAqE0SVBi4c 4Cy6gEB/nL9DLf1W+YsvYOsIvGHib5zYhX8px2ZlFDH3G2SDS2xq64nBP1BAFhsnml25 p8y2JfJlfP5mBrnDh5jRxWbWT8AwbwAxOPubixF6qL3cHo9074/mD/f1Nw9XGfQrXGuG WShYUk9C2cw3SpkxH1wxmRLXEf+X8YVgSEomwHxhAbbfo0P5iVos2pnRKcLdgvw3NpCq emEw== X-Gm-Message-State: APf1xPC5YR4q/ZAfA+VWX6ZRZLbY/tY4XpIg+XCEb8WAsgsbmmzk/XYJ R/mBhHQ24u8GEyYG4U8Qtv3jOgLGH/eaB9TqVJ3023devf4= X-Received: by 10.107.53.22 with SMTP id c22mr1644066ioa.189.1518108741504; Thu, 08 Feb 2018 08:52:21 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.50.198 with HTTP; Thu, 8 Feb 2018 08:52:00 -0800 (PST) In-Reply-To: <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> <20180208154459.GA25181@hirez.programming.kicks-ass.net> From: Vincent Guittot Date: Thu, 8 Feb 2018 17:52:00 +0100 Message-ID: Subject: Re: [PATCH v2 1/3] sched: Stop nohz stats when decayed To: Peter Zijlstra Cc: Ingo Molnar , linux-kernel , Valentin Schneider , Morten Rasmussen , Brendan Jackman , Dietmar Eggemann , Will Deacon Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 8 February 2018 at 16:44, Peter Zijlstra wrote: > 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. I think it's safe because it is used to re-enable the periodic decay unconditionally. It is cleared with rq->lock held to prevents any update of the cfs_rq *_avg while deciding if we can clear has_blocked_load > >> >> + >> >> 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.