Received: by 10.192.165.148 with SMTP id m20csp3700281imm; Mon, 7 May 2018 17:44:01 -0700 (PDT) X-Google-Smtp-Source: AB8JxZo3RxxmX+hHG2qkrNKYnlP6wDJ2DyfZpUvYhk8yhj0+dTyct0xlqFpP0Y//ZywOOu5B8fCH X-Received: by 2002:a17:902:6bca:: with SMTP id m10-v6mr39305012plt.6.1525740241447; Mon, 07 May 2018 17:44:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525740241; cv=none; d=google.com; s=arc-20160816; b=LIX0oaV5U/s0DD1hesqFKStd7acpEWT/4e8zRGdOLRU3PFVJ814FlFdoQjj45bek40 JgPl75eM1HcnlhdfvXUr+n1FBzXeVV9IHuPFpmSfjIZyR9TqHepYGFNAyYYI1pmxIwDL 8FlugPur3FZaUt8lf+xLVvpti5o+AgW6QwguEXrOj1/qco3PFWO4PaHyfMaTZJWpE/R8 qlkzyGNEe0Tp6tD8tKHgkKZDLpM4l5MyArkFipvIBX93h0yvtcfviOsnfSCdTXib6QHc fH/ASkwwzi0jOsOeEzvVfX8YprAq2DybHOWnq6WDjlFOTrPUbOudDQU6sAam5wCSgcUF LG1w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dkim-signature :arc-authentication-results; bh=Xj+3oakpcy22bmyAScx8kqQ7kcQrMQCp7PiTuv06FeQ=; b=oB/gm0S3+vZ093TKBKljU9ECCXiUV+9q9dKjm/hEQ6fQjm77n0rqzGHDroKrrISyQB 2szJisrqaJiYjolngn4kqwQEol5UME5SU8C+s78EhNEquSyCUbayXkeerd6vx+xYRiAX uw/sER4JdZqGHZ969EnGL+BVaS1qmqrUEhFdIDJmdweIoAmUkDtCDj5NhofDnYpyX3Y8 VFjOW0NvN8Uzs+dlHtG2LBr9oljPr+x5JZlyTka57BXHR2dX9E50pfr2J/Vg+vhObV8d 4412p33BSQ/nxol6f6mVXyunq5a1ztze7KzCFjmVyNbOBrJRRqZJxKZDANSLuhCZSqAg oe+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@infradead.org header.s=merlin.20170209 header.b=r/+f5nOj; 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 k4-v6si6845725pls.407.2018.05.07.17.43.46; Mon, 07 May 2018 17:44:01 -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=r/+f5nOj; 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 S1753828AbeEHAnW (ORCPT + 99 others); Mon, 7 May 2018 20:43:22 -0400 Received: from merlin.infradead.org ([205.233.59.134]:55802 "EHLO merlin.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753465AbeEHAnT (ORCPT ); Mon, 7 May 2018 20:43:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=Content-Transfer-Encoding:Content-Type: In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To:Subject:Sender :Reply-To: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=Xj+3oakpcy22bmyAScx8kqQ7kcQrMQCp7PiTuv06FeQ=; b=r/+f5nOjMtVxbE7otZYPT7k5m4 l9y0/+HRc4Ei1HcL5ZGJs3MgjJac8zdtZE2Ywbk8MIzJwu8TMxpsGmzxGnXw46aId4cOJrw3RPYz5 bP0MFJCQ5ZDl6IjXqUCf2NWsdVuNN2zplScXg3TJd4StwBnHqIUK+/l3HvAc7EmL0sLR5rJA5qCiG hL0OzYBuYmMQJidaT5R7cjcx9Xk9yRpGYff/GpTgQvT6vbS+QaXZ3bH1KCaIYOp1z0ibh18NPIlCF CAd/xgqE+ZBD05s3gniVAJPgHqKM8oOyBRDMIqna0MRGEE9V0RzEnd/HxruNg/RTCKjh236AlYiSk eej8xVPQ==; Received: from static-50-53-52-16.bvtn.or.frontiernet.net ([50.53.52.16] helo=midway.dunlab) by merlin.infradead.org with esmtpsa (Exim 4.90_1 #2 (Red Hat Linux)) id 1fFqiF-0008Uw-0q; Tue, 08 May 2018 00:42:39 +0000 Subject: Re: [PATCH 6/7] psi: pressure stall information for CPU, memory, and IO To: Johannes Weiner , linux-kernel@vger.kernel.org, linux-mm@kvack.org, linux-block@vger.kernel.org, cgroups@vger.kernel.org Cc: Ingo Molnar , Peter Zijlstra , 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 References: <20180507210135.1823-1-hannes@cmpxchg.org> <20180507210135.1823-7-hannes@cmpxchg.org> From: Randy Dunlap Message-ID: <024fba07-eece-3878-0924-ea9fd601542d@infradead.org> Date: Mon, 7 May 2018 17:42:36 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <20180507210135.1823-7-hannes@cmpxchg.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 05/07/2018 02:01 PM, Johannes Weiner wrote: > > Signed-off-by: Johannes Weiner > --- > Documentation/accounting/psi.txt | 73 ++++++ > include/linux/psi.h | 27 ++ > include/linux/psi_types.h | 84 ++++++ > include/linux/sched.h | 10 + > include/linux/sched/stat.h | 10 +- > init/Kconfig | 16 ++ > kernel/fork.c | 4 + > kernel/sched/Makefile | 1 + > kernel/sched/core.c | 3 + > kernel/sched/psi.c | 424 +++++++++++++++++++++++++++++++ > kernel/sched/sched.h | 166 ++++++------ > kernel/sched/stats.h | 91 ++++++- > mm/compaction.c | 5 + > mm/filemap.c | 15 +- > mm/page_alloc.c | 10 + > mm/vmscan.c | 13 + > 16 files changed, 859 insertions(+), 93 deletions(-) > create mode 100644 Documentation/accounting/psi.txt > create mode 100644 include/linux/psi.h > create mode 100644 include/linux/psi_types.h > create mode 100644 kernel/sched/psi.c > > diff --git a/Documentation/accounting/psi.txt b/Documentation/accounting/psi.txt > new file mode 100644 > index 000000000000..e051810d5127 > --- /dev/null > +++ b/Documentation/accounting/psi.txt > @@ -0,0 +1,73 @@ Looks good to me. > diff --git a/kernel/sched/psi.c b/kernel/sched/psi.c > new file mode 100644 > index 000000000000..052c529a053b > --- /dev/null > +++ b/kernel/sched/psi.c > @@ -0,0 +1,424 @@ > +/* > + * Measure workload productivity impact from overcommitting CPU, memory, IO > + * > + * Copyright (c) 2017 Facebook, Inc. > + * Author: Johannes Weiner > + * > + * Implementation > + * > + * Task states -- running, iowait, memstall -- are tracked through the > + * scheduler and aggregated into a system-wide productivity state. The > + * ratio between the times spent in productive states and delays tells > + * us the overall productivity of the workload. > + * > + * The ratio is tracked in decaying time averages over 10s, 1m, 5m > + * windows. Cumluative stall times are tracked and exported as well to Cumulative > + * allow detection of latency spikes and custom time averaging. > + * > + * Multiple CPUs > + * > + * To avoid cache contention, times are tracked local to the CPUs. To > + * get a comprehensive view of a system or cgroup, we have to consider > + * the fact that CPUs could be unevenly loaded or even entirely idle > + * if the workload doesn't have enough threads. To avoid artifacts > + * caused by that, when adding up the global pressure ratio, the > + * CPU-local ratios are weighed according to their non-idle time: > + * > + * Time the CPU had stalled tasks Time the CPU was non-idle > + * ------------------------------ * --------------------------- > + * Walltime Time all CPUs were non-idle > + */ > + > +/** > + * psi_memstall_leave - mark the end of an memory stall section end of a memory > + * @flags: flags to handle nested memdelay sections > + * > + * Marks the calling task as no longer stalled due to lack of memory. > + */ > +void psi_memstall_leave(unsigned long *flags) > +{ -- ~Randy