From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.6 required=3.0 tests=DKIM_INVALID,DKIM_SIGNED, FSL_HELO_FAKE,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS, USER_AGENT_MUTT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E2769C282D0 for ; Mon, 28 Jan 2019 23:54:10 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 718BC21783 for ; Mon, 28 Jan 2019 23:54:10 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="dZRrlMcd" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 718BC21783 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id 097348E0002; Mon, 28 Jan 2019 18:54:10 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 047AE8E0001; Mon, 28 Jan 2019 18:54:10 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E039E8E0002; Mon, 28 Jan 2019 18:54:09 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by kanga.kvack.org (Postfix) with ESMTP id 895718E0001 for ; Mon, 28 Jan 2019 18:54:09 -0500 (EST) Received: by mail-pf1-f197.google.com with SMTP id x67so15304460pfk.16 for ; Mon, 28 Jan 2019 15:54:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:dkim-signature:sender:date:from:to:cc:subject :message-id:references:mime-version:content-disposition:in-reply-to :user-agent; bh=Et9WX7qudex6I3J38R5ZTdZpG3jgKN8rPBOLVxxywZw=; b=eG6Kf0hW1jwcIg0Yew1bYirAJZMRFVo3sUttP7aN4IxIR699+jYw/QJVDLhiJS9UCe bwNfFehFYlVd2qmqYnhbdeqrs531HL6GpUYL7cenl5G4EXoA0Vebw0YSAo3EprA4rFeY PxQaHt5OxfR+a6kkjMi2iuDA5wBuubv7W9oq1o4gYUZMBwRpqwNDOPk/HJUwycPQLI3W 45Gy/1MRm6N93kyo/Vm1VIo4QbGxM1DM41Tmiol3+AXs2axTT7UDsKacsxgTIiz7jq7l ktpa5bxvcNskC6H0ZRjYpDBsrIfg2dDNMBCOkR9v3SahxeFh9IS3btEM4GWgKDMOF2Zn g2+A== X-Gm-Message-State: AJcUukf4TZuLLevj+wDQCtc78njmvWkICoKXxx7dcN+phoXpbvIMwqHq wqsf623IGSUkZPF7pz2k69WGx7QVSvsz4lplP1YQVHHtRLZwNbTbmdlwUg3A0WVJez9KromLal0 NsvXpKR36/DzNKKYWNjp5hqhwLCUJQ1BYYFFWRPjTcLcuD0SR0no/Fpm9Icpac5NmuPGcBansim QSegi/8RQkpvUrmn4fuU7A6dVuI9BI+tI78CRChMQmHDd79qXlByJOkAUMeaT1PlLEB1eUlash1 T7S3wmwSd18pKIX4W3A2G2nbhYPh8Z7LcDEwyc2rx6g/FL4z6RyO6HjVACnZ8Q1x0GKV2ezwfe+ IRrOTGd2wyfO2XySDDcJSJFwgIGfrHNDwHUXkzXj3WWbpQ2J+6WqYOmmX0Ai9sR9YxJEWj6Cug= = X-Received: by 2002:a17:902:365:: with SMTP id 92mr22723517pld.327.1548719649100; Mon, 28 Jan 2019 15:54:09 -0800 (PST) X-Received: by 2002:a17:902:365:: with SMTP id 92mr22723422pld.327.1548719646961; Mon, 28 Jan 2019 15:54:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548719646; cv=none; d=google.com; s=arc-20160816; b=IchK9x7ZIVNgnebjOEV3PJLjz3DiT7uwszzvKIJkLlMXG+SOcyWGclpl3GqdLjbQdO u9gKPRtQZ0phIwYztnfMLl1Hv7/7bM83bz5GgbM4C4ngSa3P0VK/Dcy9LkBPtHXqQalt koxNrJ2QOzQBYmFMRp1J6ejSapYejHfRu79kG/aYQRa0Er28EThZPTs/Br/rBYGYshfl KxGLK5ejAJbIWg/o9T1T0S1yhLvKZ3YYXH+k7QFy6hkolC5inzpT6zL4i6dK4qBejsHr Us8CLUKD56Q6ZO2y6b/KSogapupC5j3Yc1YyBN8KAIY8UivLpD3UhycFVU9R6dhzsEfj Tr7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:sender:dkim-signature; bh=Et9WX7qudex6I3J38R5ZTdZpG3jgKN8rPBOLVxxywZw=; b=e1upcnc+z6p8AjZBSXMv3AxMvGoGtF/AikQ4ZHeg1PHyKoY1FMDqbQNSwKTRf0AR4r X/29tb8SrlQmfnq6TRNeVCfZuH7b6FaUdYao/jPiQFTmR5VYPXX8nZeRhoTpV3q/X3GK XSDnAetKXrdQgAbITXZjRPajFajUP/lFhiqZZIEuL/1R/hWUU0CaMEy0Y3B63CtnZi+k 3nCWkjF+eH83EWvx34Ep/tkEv18gLW+/ynDj5l/R+xsJ2N1Qk/INgtpQIO2xEZjvVGBc jw4tZ+F+CZfvwzMsLQmqeli6p3d1JCnJk4JNWwy0JrelowZ/Mcmbhae4jbC5bSQqy7IY p36Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dZRrlMcd; spf=pass (google.com: domain of minchan.kim@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id v3sor3378247plg.12.2019.01.28.15.54.06 for (Google Transport Security); Mon, 28 Jan 2019 15:54:06 -0800 (PST) Received-SPF: pass (google.com: domain of minchan.kim@gmail.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=dZRrlMcd; spf=pass (google.com: domain of minchan.kim@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=minchan.kim@gmail.com; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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-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) X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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: > + > +