Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3289243imu; Mon, 17 Dec 2018 17:16:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/VHzU7MnpbbigU59dOcUqewT56yDKBEtWJjc+M1mhH2wgfCYU2/mPW6pxf8R0NgPI51ywoB X-Received: by 2002:a17:902:fa2:: with SMTP id 31mr14081705plz.75.1545095772174; Mon, 17 Dec 2018 17:16:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545095772; cv=none; d=google.com; s=arc-20160816; b=xquB2dVmWHKO157Ahf3AgVg0fsD7WnfI+ExK4bEN9FsnxvmeL8fed6DvyU+vr+W3Lq dilNrtr+m+C6tjLK6R9Fjtzg/JKVeoD2+7jA7HF4nQLoZ1j0Hh6DuzwNhwDzjBueS6cG M1sa3YFbDdEsKB2v/plj2+T9fqs73lcjx3TNVZbZlIPto5QebkBLM3HZBELR6TTg2FYs l4cKI2fexkRQCcEj0G4LhY1+pL8qq/Pj/H3eDqXxDgBe+/1g3OD/uk5sR5Irlv45FX5B qjz00mL48n7xu9gy6e2yauOsqjzqBCKMWGKm4MJj0NAkjfVUJ1rinKSZSS84gIYPT5F1 6j4g== 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 :in-reply-to:references:mime-version:dkim-signature; bh=MtV8grmjLA0rwx3YhGhQj1UX/LL1RwYw0cDYDYDCZQ4=; b=krvguRpQoM6twJQCVg5jKQPdGJLC9nu8HW2ERDKmemP6S0FW3brL7VeMHB+CHCGzH/ mEso52wnGGhyyu14oJTNmOWu9E3FC1JZH95sUepzrEtUJyf7EZWWoITdDMy7CU0VVG2C Lkd6c6TpsXEm90xzvx7v7UM5gPy9PPgIdNxerZsZkKUGJHMCXA+Ipl5qKo5nBcXa7EB1 Uq5j3JSbiRrO508qsPdw6MLgARFWc634vtD/57Igw5/fQn5Za7lwDlDkykmzNz3a4Auc 3JfG+8IynoHhoq8/DdT82dw698CI72R6ga+6/AiB74IWbJvzA1hxywnF7mM0KLmvllRa fYfA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=HhtqGWhr; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s12si12193416pgh.488.2018.12.17.17.15.56; Mon, 17 Dec 2018 17:16:12 -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=@google.com header.s=20161025 header.b=HhtqGWhr; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726414AbeLRBPG (ORCPT + 99 others); Mon, 17 Dec 2018 20:15:06 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:35665 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726336AbeLRBPG (ORCPT ); Mon, 17 Dec 2018 20:15:06 -0500 Received: by mail-wr1-f65.google.com with SMTP id 96so14212929wrb.2 for ; Mon, 17 Dec 2018 17:15:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=MtV8grmjLA0rwx3YhGhQj1UX/LL1RwYw0cDYDYDCZQ4=; b=HhtqGWhr4ELtOVTsQaCzl2jfH5UQSFbjJ7o0cQPu3tty6slMA5FrhcMyuWO1862TPC TovMgF0u9tuNUPWYSU3wBU+0sTAK7m7KKZ51S+rSpJNjy8Z5TEPt8HN2xJLke0aWMze2 g6huHXJmZfpJgb82OUlb80GH6G72sXqfTLAkuFGOO8uML3Dw7NUlIwBiaAubDnk6GyiC RQxOzg3vvGHYzXPfDRWdgwrvpD3M3+HNrEUpI1oAKGR9FrpzlZ9mRzp4lf3qUM9Pij8v Uq/mmngb36fGkAijmpWMUx7rWM5WCXfaRx8ZyJokBUrz8Gt2kg+Fals6cH5C1wyK/Q4h qobQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=MtV8grmjLA0rwx3YhGhQj1UX/LL1RwYw0cDYDYDCZQ4=; b=bxZ8tH2BkK/dGdlA1iD4YQIfNsWS8kDGH3MXNMZOuAA1p5C04Wk+3pahCE2NsUvV2V HGSguZ6kE3JIzC8i6BfSET88SAydtWlvfQ2x3QpJ0fu4nCmMQ4109cZQSLjSMGbYy1L/ 2vSnoFmXx74B58b9IVY5vHiTPL8zUnlPys1jkrHgHixsrNKembUQON5SLHaQDFHWBT/v 8sp7TCGGwkkbNiuS6dBLOJAlyN063zOH1qjElb2RbB5D2P/+TM44fxgS/3WZ6sS+gYst vEEN6yU5pXfJ7HeYbNXKuLMQywnwugzxBSs714q+WpbS/7+mzK4sjURAdzfla67kqhwV klnQ== X-Gm-Message-State: AA+aEWaYxwrhkL88UqMJsDEpD6LFNQ+A3CLFNQ1O6ZHMp4OdWjlNX0ny Y7uFZIxn21zn330veszuX2ah238sS8Giw3VCicMeUA== X-Received: by 2002:a5d:4e82:: with SMTP id e2mr12163482wru.291.1545095704461; Mon, 17 Dec 2018 17:15:04 -0800 (PST) MIME-Version: 1.0 References: <20181214171508.7791-1-surenb@google.com> <20181214171508.7791-5-surenb@google.com> <20181217155525.GC2218@hirez.programming.kicks-ass.net> In-Reply-To: <20181217155525.GC2218@hirez.programming.kicks-ass.net> From: Suren Baghdasaryan Date: Mon, 17 Dec 2018 17:14:53 -0800 Message-ID: Subject: Re: [PATCH 4/6] psi: introduce state_mask to represent stalled psi states To: Peter Zijlstra Cc: Greg Kroah-Hartman , Tejun Heo , lizefan@huawei.com, Johannes Weiner , axboe@kernel.dk, dennis@kernel.org, Dennis Zhou , Ingo Molnar , Andrew Morton , Jonathan Corbet , cgroups@vger.kernel.org, linux-mm , linux-doc@vger.kernel.org, LKML , kernel-team@android.com 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 Mon, Dec 17, 2018 at 7:55 AM Peter Zijlstra wrote: > > 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. Will do. > Also, since I just had to re-count, you might want to add explicit > numbers to the psi_res and psi_states enums. Sounds reasonable. > > + if (state_mask & (1 << s)) > > We have the BIT() macro, but I'm honestly not sure that will improve > things. I was mimicking the rest of the code in psi.c that uses this kind of bit masking. Can change if you think that would be better.