Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4034300imu; Mon, 28 Jan 2019 15:54:29 -0800 (PST) X-Google-Smtp-Source: ALg8bN6Nd0lTjH6L8jHIT8qwlB3d18vd7Ii6sU++quMUEDz7Qle7H7rzXuHnI8wir/c3vM3J8NgV X-Received: by 2002:a63:7f4f:: with SMTP id p15mr21865290pgn.296.1548719669297; Mon, 28 Jan 2019 15:54:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548719669; cv=none; d=google.com; s=arc-20160816; b=pOIpyLn4RKnjxTVFw0ZU1L36zwn4GwYlHKA3RnRt55RTCqNj9flCggianT9EorUyO2 KHHrrG/QuIijtdIwaqYCxI5nKIQcFqtewBj2peHJCtCKqKT27kzOUJuHtS8sKi46JUyS VOOfrhHvzMP93hnRpiwh1hoCTqdBqJsXkx7fsC1RucYeYTCoDZpfDG5qupqrMGvunFDc BiPPaKwVoGFs53msMcTVF6nvOajCB5MnEO2jBu4esYWpC3RvkbmNF9bikLbDN7aDHH5I GtGRNFr9OWFp/E/mZnH91k6afnCb/+Cs70LXHN84Vq/251ITkFOIa3jCStnyVRrbcJzQ jWuQ== 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=Et9WX7qudex6I3J38R5ZTdZpG3jgKN8rPBOLVxxywZw=; b=D31aP3i/a0Glt9Cy4E8ahQNxoFcJCyr5gAwvqK/fOCN4Nkqqs7IxKhJGPoQrirLHrW 4yuf6SV4rB5YLY8+riZ/tM7Y/nOebQYBYO4v13l4CTdd+oEho45QrAK8HOCJpVdMkvak 4lNjKL/dgyc6/a9DU19p3l15jpIBcH518w28ZvO3ubV2PH5WDZFSphK+3DX4FsMT+8Sb bNvAqOO+3AVl1e34lSXSBgXDNbnYsnLWZQhT7j8VHVi7TmVqlBgrV2j1pd8/2nKqHLtS ST62Yr5IdliKvNiLa1AonrBKYVecXxu+IwzBkqU5+doZ0Wx8moul8VgzlnCxzKAVtFHe bjOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=dZRrlMcd; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u11si3228483plm.8.2019.01.28.15.54.13; Mon, 28 Jan 2019 15:54:29 -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=@gmail.com header.s=20161025 header.b=dZRrlMcd; 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=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727162AbfA1XyI (ORCPT + 99 others); Mon, 28 Jan 2019 18:54:08 -0500 Received: from mail-pl1-f195.google.com ([209.85.214.195]:40310 "EHLO mail-pl1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726746AbfA1XyH (ORCPT ); Mon, 28 Jan 2019 18:54:07 -0500 Received: by mail-pl1-f195.google.com with SMTP id u18so8478812plq.7; Mon, 28 Jan 2019 15:54:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Et9WX7qudex6I3J38R5ZTdZpG3jgKN8rPBOLVxxywZw=; b=dZRrlMcdIdTtC65YxgEy4yDRPtuLfj9sNemUhowoQQjuUh4XL/cMQQ5YuBQkn1d4L9 CTBpLq0LpsHirfgeqLsSmZaVcKex/KtLKkviBXQZ5HDf2avTeDUFFnsLnRid6F3p+5Gs 84UT6BPHtLPgIU7Vbyre53cucTb8gDiaL9e+SPLVqwqs6QOZiCPmKLmXUtLhjVTHOgaO Z+xHXz/ciDh7wRw3ztGfqNM5l7ZfKOWccUvDBBVD0u8uhzc5tlJSjlYE1sWI0wMPcMGq 7j3K3JS/e+MNMf6pYFSb/ver/DfIiNCAYEsvFQkK6bJq2lRp8ozvxrXhLwVszHH2LLj7 mAlA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=Et9WX7qudex6I3J38R5ZTdZpG3jgKN8rPBOLVxxywZw=; b=s11WEWUj0HofWZ9fPHunP84cPRyfbo7m2grGOfb+EP6OTDmbx+ol4QeaMy1SZee1ck RWsBMsliD3KMCC0W4tqiyz5jeJetwMCK5NuuVCSBbFVqsoDeNSuYPS5pt75qUF0Ej1Ll jY1vB0U0Pp1zgwkRuCr+mbYultPHdzgDDYiHhextfpJmgCwGS7KPwIvNac7lDGIA7mlh h9l38zgU/bm/cSWbRB19z20PRyVWhrDnvSZeVdAbbasfzxz0UuBYdFwVZbNQT7w8xRxf 9kV2KfvuZFqhKbQoOY4PzT8o5qikZOc9X9abCaVDixizhrKLbB+n8pcgxltolJwDACWx hyHQ== X-Gm-Message-State: AJcUukdVHv+8a8EWTXsibgZRsZ4g46GAX5TCo/DA02gS9Df5mi2G8pzt tqq8LrBRP+Ne0l8felGAu6KQt/QT X-Received: by 2002:a17:902:7848:: with SMTP id e8mr24324314pln.100.1548719646033; Mon, 28 Jan 2019 15:54:06 -0800 (PST) Received: from google.com ([2401:fa00:d:0:98f1:8b3d:1f37:3e8]) by smtp.gmail.com with ESMTPSA id e86sm48357902pfb.6.2019.01.28.15.54.00 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 28 Jan 2019 15:54:04 -0800 (PST) Date: Tue, 29 Jan 2019 08:53:58 +0900 From: Minchan Kim 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, peterz@infradead.org, 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 v3 5/5] psi: introduce psi monitor Message-ID: <20190128235358.GA211479@google.com> References: <20190124211518.244221-1-surenb@google.com> <20190124211518.244221-6-surenb@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190124211518.244221-6-surenb@google.com> User-Agent: Mutt/1.10.1+60 (6df12dc1) (2018-08-07) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Suren, When I review first time, it was rather hard to understand due to naming so below comments are mostly cleanup or minor. I'm not strong against if you don't think it's helpful. Feel free to select parts. Thanks. On Thu, Jan 24, 2019 at 01:15:18PM -0800, Suren Baghdasaryan wrote: > Psi monitor aims to provide a low-latency short-term pressure > detection mechanism configurable by users. It allows users to > monitor psi metrics growth and trigger events whenever a metric > raises above user-defined threshold within user-defined time window. > > Time window and threshold are both expressed in usecs. Multiple psi > resources with different thresholds and window sizes can be monitored > concurrently. > > Psi monitors activate when system enters stall state for the monitored > psi metric and deactivate upon exit from the stall state. While system > is in the stall state psi signal growth is monitored at a rate of 10 times > per tracking window. Min window size is 500ms, therefore the min monitoring > interval is 50ms. Max window size is 10s with monitoring interval of 1s. > > When activated psi monitor stays active for at least the duration of one > tracking window to avoid repeated activations/deactivations when psi > signal is bouncing. > > Notifications to the users are rate-limited to one per tracking window. > > Signed-off-by: Suren Baghdasaryan > Signed-off-by: Johannes Weiner > --- > Documentation/accounting/psi.txt | 104 ++++++ > include/linux/psi.h | 10 + > include/linux/psi_types.h | 59 ++++ > kernel/cgroup/cgroup.c | 107 +++++- > kernel/sched/psi.c | 562 +++++++++++++++++++++++++++++-- > 5 files changed, 808 insertions(+), 34 deletions(-) > > diff --git a/Documentation/accounting/psi.txt b/Documentation/accounting/psi.txt > index b8ca28b60215..6b21c72aa87c 100644 > --- a/Documentation/accounting/psi.txt > +++ b/Documentation/accounting/psi.txt > @@ -63,6 +63,107 @@ tracked and exported as well, to allow detection of latency spikes > which wouldn't necessarily make a dent in the time averages, or to > average trends over custom time frames. > > +Monitoring for pressure thresholds > +================================== > + > +Users can register triggers and use poll() to be woken up when resource > +pressure exceeds certain thresholds. > + > +A trigger describes the maximum cumulative stall time over a specific > +time window, e.g. 100ms of total stall time within any 500ms window to > +generate a wakeup event. > + > +To register a trigger user has to open psi interface file under > +/proc/pressure/ representing the resource to be monitored and write the > +desired threshold and time window. The open file descriptor should be > +used to wait for trigger events using select(), poll() or epoll(). > +The following format is used: > + > +