From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on archive.lwn.net X-Spam-Level: X-Spam-Status: No, score=-1.7 required=5.0 tests=DKIM_INVALID,DKIM_SIGNED, FSL_HELO_FAKE,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham autolearn_force=no version=3.4.2 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by archive.lwn.net (Postfix) with ESMTP id 5D6E57D04D for ; Mon, 28 Jan 2019 23:54:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726937AbfA1XyI (ORCPT ); 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-Google-Smtp-Source: ALg8bN5WfbALqzaYgt+x4aEJG1uHbbSDTJmF85b5AJQAWh+9nWJK4mRqn5lQ7leS/xu/pygy3a88CQ== 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-doc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-doc@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: > + > +