Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3117989imu; Mon, 17 Dec 2018 13:41:59 -0800 (PST) X-Google-Smtp-Source: AFSGD/U2OiOoCZk8dZ8O2dET2bmAEii3LQUIFE232ndUcyQ702JxsHrdWQOzgLeBioSoxs7meUl3 X-Received: by 2002:a17:902:27e6:: with SMTP id i35mr13806021plg.222.1545082919870; Mon, 17 Dec 2018 13:41:59 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545082919; cv=none; d=google.com; s=arc-20160816; b=ND68ObsBaqb5ydkKnXuoaMgk9XlUBDRIkX1N+OAs+yKhv9iRQffgn2ZsZz/i2oJMsa misfp4HfkwcpGgyRg8oc3FoirKA061iQfcG3E44L/lUhf+zSuEgCXIdKCSLzvO8Bctja TEBgllGjXmj9wBuPD3cKvQUUw8SdUsB3BKawdQxXpCsIGzXHBG8HO919eJHrblI24Y2P e7k7qhkAk2ye8wYG9b0UzG3TB5A/v4Opyz6aaLgcGHtsMgDmbsPizOmY/3uoixEBWaVF GeWYs+klIngos9C2VoFYOY3Z4A6oV+SigURSN/9RrrKWmxtB+NEJvLMm95vgJYyY9eNf 58rQ== 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; bh=574+4ZD7Du9DDrY3jcdjsYd7VDFDIpxaJakuUWbr19s=; b=G8Geenup3rzpajsPiPzla/TjTYvU4c/AjGV0l7e5dANqzfedYyw9Zs4AVIBmJtxS41 4T8vSY89ZTsjVGolYgIQhL3ZeUtJC4C2r/hWujz8DEFwlw9mpO66sj6wb2ra7cEyz2U+ mIB2E0wUEdrlwswg9ljqqbqbk+hx/wGut95VUUV0FDgc+1wg6wdRXJi7yxCMFXV1K67D 5n/Sxh7XWbTT5nI503DKHUUEvd5Ts6e0n6sLJnPBW7Oq5nBIyIotm245qER7m8roAtfv ROeUtKwhTDQbVeKph3AwVmrw4mAq+jTyC3bqd/ByOp9wJuOMwFSY7XEqOdV8l0Vcp34y Tb+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=NzN4oTZi; 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 bb4si11457415plb.322.2018.12.17.13.41.44; Mon, 17 Dec 2018 13:41:59 -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=NzN4oTZi; 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 S2387941AbeLQPzl (ORCPT + 99 others); Mon, 17 Dec 2018 10:55:41 -0500 Received: from bombadil.infradead.org ([198.137.202.133]:39890 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727617AbeLQPzl (ORCPT ); Mon, 17 Dec 2018 10:55:41 -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=574+4ZD7Du9DDrY3jcdjsYd7VDFDIpxaJakuUWbr19s=; b=NzN4oTZi6gyJm2aSWquP3ym0d 9omamrHx6pqwcZKsaR2e90jn3JJGPgWxUbNtXeKUrfjI47HpoiolK5gTOXYmROfIcTsA4j38T2tS6 QwtlKihqL0AwxJKPVt2KhAMOEkNu+c9hCRXVjbXZIp9geLuF9OkitZG5hfKTCJ3BtBmTXjGlrSYI1 4TgSqH4hgpz+eFez7W8mmEGlwcbjR5NRugb3gofnJfLixyB/rnj0dIWTg3Trhfze1lT42vr5lqQVB Z5uHM1LAngIidwmkDDiiTrrPgFICAjkZgEEmZ5miFSveGJjArtzaUovOv2s9v6TQNP94sjT0v0yGT oftNPPBHg==; 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.90_1 #2 (Red Hat Linux)) id 1gYvEu-0000Ca-Vq; Mon, 17 Dec 2018 15:55:29 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id 7717F20276AC4; Mon, 17 Dec 2018 16:55:25 +0100 (CET) Date: Mon, 17 Dec 2018 16:55:25 +0100 From: Peter Zijlstra To: Suren Baghdasaryan Cc: gregkh@linuxfoundation.org, tj@kernel.org, lizefan@huawei.com, hannes@cmpxchg.org, axboe@kernel.dk, dennis@kernel.org, dennisszhou@gmail.com, mingo@redhat.com, akpm@linux-foundation.org, corbet@lwn.net, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH 4/6] psi: introduce state_mask to represent stalled psi states Message-ID: <20181217155525.GC2218@hirez.programming.kicks-ass.net> References: <20181214171508.7791-1-surenb@google.com> <20181214171508.7791-5-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20181214171508.7791-5-surenb@google.com> User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Dec 14, 2018 at 09:15:06AM -0800, Suren Baghdasaryan wrote: > The psi monitoring patches will need to determine the same states as > record_times(). To avoid calculating them twice, maintain a state mask > that can be consulted cheaply. Do this in a separate patch to keep the > churn in the main feature patch at a minimum. > > Signed-off-by: Suren Baghdasaryan > --- > include/linux/psi_types.h | 3 +++ > kernel/sched/psi.c | 29 +++++++++++++++++++---------- > 2 files changed, 22 insertions(+), 10 deletions(-) > > diff --git a/include/linux/psi_types.h b/include/linux/psi_types.h > index 2cf422db5d18..2c6e9b67b7eb 100644 > --- a/include/linux/psi_types.h > +++ b/include/linux/psi_types.h > @@ -53,6 +53,9 @@ struct psi_group_cpu { > /* States of the tasks belonging to this group */ > unsigned int tasks[NR_PSI_TASK_COUNTS]; > > + /* Aggregate pressure state derived from the tasks */ > + u32 state_mask; > + > /* Period time sampling buckets for each state of interest (ns) */ > u32 times[NR_PSI_STATES]; > Since we spend so much time counting space in that line, maybe add a note to the Changlog about how this fits. Also, since I just had to re-count, you might want to add explicit numbers to the psi_res and psi_states enums. > + if (state_mask & (1 << s)) We have the BIT() macro, but I'm honestly not sure that will improve things.