Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp710496imm; Fri, 3 Aug 2018 10:10:22 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcwzuuAyCcPW/SKZYTXEbmE1avdIKGWQl7pyVghb2My4Vcm1LGDUsf+K8Y7oeW/sdLK+QGb X-Received: by 2002:a17:902:1121:: with SMTP id d30-v6mr4452406pla.247.1533316222850; Fri, 03 Aug 2018 10:10:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1533316222; cv=none; d=google.com; s=arc-20160816; b=oYwiyVtR4OV//tZxnOLGmb78MHihWPh8lLI0ls1ePhYZO/+8NkRNwLcDMiaiFgGeF5 zHFdIl2ChOQ3erJyeenUMtI7GY4GIcnGMzevMV6pTpotuli2irR/y4M/54xqIDBYNYdz GhVWwHc1d82c9K3Mf/mersWam2J2WhbL/EN+qZ1+gaBVKXircLK7SsKQ5Rhue+GWIILT FQz8sGg29udLkTapbaJaEdwoO8v3U45ZlBuecNIGr+08CCiAMs9phpGI66ZRNQgiu6b2 6ScnjsuNNrLwBMJ+RayviW2ePpJwUIrc3q75NpDBWW4mEkfWzqgr+21APdYo8nVtlt7z hpqg== 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=5szedLwDdh86mfXSaF1CUenBlLCBHTbq16JXDwCdXgM=; b=niLgRtmH2a8MT19RAquIRy+lgP4lnKFEV8LaHF5rqBLeC++NW7Vb95Jaq16viULt62 fTA2HVeyIB/bDAndBFEx0rfIBwBs08d79VccF1bgQbOhb19SUgHKer9ACINc5kwV36lB rCBm+wzN5MM5xb6EXQqdYWjwOIz72dFboi0Fv1g+77Y/MOuYcI7id94zQ/FxkLgWaoRU KZgIWXovuqCRALdu9dEXYZSV2hbUh3dKrJXy1OgPJNsu6R4ujpwPIpMpojrgqwiXj5L5 Frk6RMOqKvQqSFNDdRftCwMf+DVu0m6PhGtP3gWkGV/1wIf0dOkTk1oLAavsItfKKem4 0Iow== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=rPUzNrvv; 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 x23-v6si5376718pgj.543.2018.08.03.10.10.07; Fri, 03 Aug 2018 10:10:22 -0700 (PDT) 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=rPUzNrvv; 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 S1728246AbeHCTE6 (ORCPT + 99 others); Fri, 3 Aug 2018 15:04:58 -0400 Received: from merlin.infradead.org ([205.233.59.134]:44236 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727356AbeHCTE6 (ORCPT ); Fri, 3 Aug 2018 15:04:58 -0400 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=5szedLwDdh86mfXSaF1CUenBlLCBHTbq16JXDwCdXgM=; b=rPUzNrvviOfJj4rJWXZG62SRr ZA1XxmAH2aFsOgae2LLaWGe3xyNu6a+yTRm1AKeO96b09fHdfTZP6x9dQGUtPk4h0Y+mCr5n47VL+ yT38RhAxlL8QQKNU6uX7OUGBpC4CFNEE/mhOWYLZlm1dEH3fS+5idtAF9VVMjtnOwHDuLe+NBGdsz JU3o7OIzEKPMe+99qPcimd98GXecyjUAj+dsRt94+eA4jmsX+cDTSSYenrF4fDXCooCHpC4IzW2Hy lXrb4Euqj1Q+omTfS6yyvwK0QMbikZ6jiQ63fE/Af/utB8uStbxStc+6NxGdrQ8BPUDnk59SuVn+d aGyT/ryMQ==; 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.90_1 #2 (Red Hat Linux)) id 1fldY6-0007JT-S2; Fri, 03 Aug 2018 17:07:35 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 2C9F620267E51; Fri, 3 Aug 2018 19:07:33 +0200 (CEST) Date: Fri, 3 Aug 2018 19:07:33 +0200 From: Peter Zijlstra To: Johannes Weiner Cc: Ingo Molnar , Andrew Morton , Linus Torvalds , Tejun Heo , Suren Baghdasaryan , Daniel Drake , Vinayak Menon , Christopher Lameter , Mike Galbraith , Shakeel Butt , Peter Enderborg , linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@fb.com Subject: Re: [PATCH 8/9] psi: pressure stall information for CPU, memory, and IO Message-ID: <20180803170733.GC2494@hirez.programming.kicks-ass.net> References: <20180801151958.32590-1-hannes@cmpxchg.org> <20180801151958.32590-9-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180801151958.32590-9-hannes@cmpxchg.org> User-Agent: Mutt/1.10.0 (2018-05-17) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 01, 2018 at 11:19:57AM -0400, Johannes Weiner wrote: > +static bool psi_update_stats(struct psi_group *group) > +{ > + u64 deltas[NR_PSI_STATES - 1] = { 0, }; > + unsigned long missed_periods = 0; > + unsigned long nonidle_total = 0; > + u64 now, expires, period; > + int cpu; > + int s; > + > + mutex_lock(&group->stat_lock); > + > + /* > + * Collect the per-cpu time buckets and average them into a > + * single time sample that is normalized to wallclock time. > + * > + * For averaging, each CPU is weighted by its non-idle time in > + * the sampling period. This eliminates artifacts from uneven > + * loading, or even entirely idle CPUs. > + * > + * We don't need to synchronize against CPU hotplugging. If we > + * see a CPU that's online and has samples, we incorporate it. > + */ > + for_each_online_cpu(cpu) { I'm still puzzled by this.. for 99% of the machines online == possible. Why not always iterate possible and leave it at that? This is hardly a fast path.