Received: by 10.192.165.148 with SMTP id m20csp5311887imm; Wed, 9 May 2018 03:00:34 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpv0gpFY6nHEgcB2bai9ex/vJc3BF+hpdf6Gky/JiA2J1ZFpGOo3EW7w9rQsNNGg+RfDw9E X-Received: by 10.167.134.20 with SMTP id p20mr43378576pfn.159.1525860034407; Wed, 09 May 2018 03:00:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525860034; cv=none; d=google.com; s=arc-20160816; b=ojtWn4AtCU/U5z11ascqae8uOcvZIkPArTVZsHKxXKUh/z7KglDhgRpfRhi0hRhnAu pX/sbPJjqxDmbBrCdpA0DRVNd8UTeKO7TQmgfG3QzqpmEZnmXH/vnW5PpIi8+JrQ8aaU PC+EBNeUD7x1vIzkiLzZco8RNr/oEdmPAcNki1NsT6j2Hg42MmMUhJ8caAw/QbIEuVEO jDtnBA/KpKPIwOt6iHWF3TGVFeseEPM3vh5K2bEhi+2L4d79VSEwBq/YfcPDa+SoFIRB wh4ZGEB6kt3YufgG8fHmSC/AJLOLS9eU3uCftkEq8zuhFBMs/B1TD+jxtDP5niujw9E4 kliw== 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=NVbh/LOsISNmbHBJlSondA21W2OEIYOM5hTTqlZZNTQ=; b=v62O4DBzKfa961DboDg3Uu1tj3wm2WDeNvOVG6C3MWZzUKV20ExQL1H84Nbz/BFLii sNE9k+rPM2pybvvMqXxNjTBLBRXn6KzNUlAFHdW8xPePNlaNgtEuZZ7Bt6+DghQ4kjo7 u/RSBYpuV4uoKQXVxp8o0LSIRyxWgJggPHJ0uNguf6w6HUR9Eu7j2i72UpRQsc1xcZJD lqhJAY1tOw/+CJHv989wjqf3wIhbYL/Gv6sjaXK2ZMcXS9mlNAyLnWlsYl1T3m1lPs5F IHUEy9FWpELAPggBQ5AEsh83vtb5D6pyrJzGR0Ma5STidB1dxmCzYAwI7+VLsz/hsaZW nwdQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=bombadil.20170209 header.b=WMJ7Kh9j; 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 p91-v6si25823773plb.457.2018.05.09.03.00.19; Wed, 09 May 2018 03:00:34 -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=bombadil.20170209 header.b=WMJ7Kh9j; 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 S1756220AbeEIJ7v (ORCPT + 99 others); Wed, 9 May 2018 05:59:51 -0400 Received: from bombadil.infradead.org ([198.137.202.133]:54398 "EHLO bombadil.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755400AbeEIJ7s (ORCPT ); Wed, 9 May 2018 05:59:48 -0400 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=NVbh/LOsISNmbHBJlSondA21W2OEIYOM5hTTqlZZNTQ=; b=WMJ7Kh9j0lkGfYTUgxcERW5BX AtgFLC+nWK2eOgh7/T8QhRIbuM4sRIT1BvGEQzUvJ6qg1UQufNrWwe+jFMImtAfckOTkUveN5PRle 988LOj/otbzwFrfgFg9iP5uPNY4TU+nxngrXGF7bPaisz23QTlKbBPMRHT77dOEL3HvP8PXu9LxF/ w+8IXN96/8zm8BH/jpkoHPLcGGUANGNLQAR1hbriyeAoMpNOF38E6HGH51daXPMVC/HpRewKefVu9 794PD3JP9zBJBKf5U2XElunO2+ebY2+vn5bJWsdOASkmGRVzaEQ6SIuqKjffoP7n9rM6wff4SBKHo NkzC3odkA==; 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 1fGLsq-0007of-Hs; Wed, 09 May 2018 09:59:40 +0000 Received: by hirez.programming.kicks-ass.net (Postfix, from userid 1000) id D05362029FA13; Wed, 9 May 2018 11:59:38 +0200 (CEST) Date: Wed, 9 May 2018 11:59:38 +0200 From: Peter Zijlstra To: Johannes Weiner Cc: linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org, cgroups@vger.kernel.org, Ingo Molnar , Andrew Morton , Tejun Heo , Balbir Singh , Mike Galbraith , Oliver Yang , Shakeel Butt , xxx xxx , Taras Kondratiuk , Daniel Walker , Vinayak Menon , Ruslan Ruslichenko , kernel-team@fb.com Subject: Re: [PATCH 6/7] psi: pressure stall information for CPU, memory, and IO Message-ID: <20180509095938.GJ12217@hirez.programming.kicks-ass.net> References: <20180507210135.1823-1-hannes@cmpxchg.org> <20180507210135.1823-7-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180507210135.1823-7-hannes@cmpxchg.org> User-Agent: Mutt/1.9.5 (2018-04-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, May 07, 2018 at 05:01:34PM -0400, Johannes Weiner wrote: > diff --git a/include/linux/psi_types.h b/include/linux/psi_types.h > new file mode 100644 > index 000000000000..b22b0ffc729d > --- /dev/null > +++ b/include/linux/psi_types.h > @@ -0,0 +1,84 @@ > +#ifndef _LINUX_PSI_TYPES_H > +#define _LINUX_PSI_TYPES_H > + > +#include > + > +#ifdef CONFIG_PSI > + > +/* Tracked task states */ > +enum psi_task_count { > + NR_RUNNING, > + NR_IOWAIT, > + NR_MEMSTALL, > + NR_PSI_TASK_COUNTS, > +}; > + > +/* Task state bitmasks */ > +#define TSK_RUNNING (1 << NR_RUNNING) > +#define TSK_IOWAIT (1 << NR_IOWAIT) > +#define TSK_MEMSTALL (1 << NR_MEMSTALL) > + > +/* Resources that workloads could be stalled on */ > +enum psi_res { > + PSI_CPU, > + PSI_MEM, > + PSI_IO, > + NR_PSI_RESOURCES, > +}; > + > +/* Pressure states for a group of tasks */ > +enum psi_state { > + PSI_NONE, /* No stalled tasks */ > + PSI_SOME, /* Stalled tasks & working tasks */ > + PSI_FULL, /* Stalled tasks & no working tasks */ > + NR_PSI_STATES, > +}; > + > +struct psi_resource { > + /* Current pressure state for this resource */ > + enum psi_state state; > + > + /* Start of current state (cpu_clock) */ > + u64 state_start; > + > + /* Time sampling buckets for pressure states (ns) */ > + u64 times[NR_PSI_STATES - 1]; Fails to explain why no FULL. > +}; > + > +struct psi_group_cpu { > + /* States of the tasks belonging to this group */ > + unsigned int tasks[NR_PSI_TASK_COUNTS]; > + AFAICT there's a hole here, that would fit the @nonidle member. Which also avoids the later hole generated by it. > + /* Per-resource pressure tracking in this group */ > + struct psi_resource res[NR_PSI_RESOURCES]; > + > + /* There are runnable or D-state tasks */ > + bool nonidle; Mandatory complaint about using _Bool in composites goes here. > + /* Start of current non-idle state (cpu_clock) */ > + u64 nonidle_start; > + > + /* Time sampling bucket for non-idle state (ns) */ > + u64 nonidle_time; > +}; > + > +struct psi_group { > + struct psi_group_cpu *cpus; > + > + struct delayed_work clock_work; > + unsigned long period_expires; > + > + u64 some[NR_PSI_RESOURCES]; > + u64 full[NR_PSI_RESOURCES]; > + > + unsigned long avg_some[NR_PSI_RESOURCES][3]; > + unsigned long avg_full[NR_PSI_RESOURCES][3]; > +};