Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4122067imu; Mon, 28 Jan 2019 17:56:15 -0800 (PST) X-Google-Smtp-Source: ALg8bN6lRJWdV7dqminCYyNNzw324PMBCQUcGLB/jCD9VlDO0Ayo1muQ6h7lG8VbmolMfarjWq+p X-Received: by 2002:a63:f515:: with SMTP id w21mr16809128pgh.220.1548726975761; Mon, 28 Jan 2019 17:56:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548726975; cv=none; d=google.com; s=arc-20160816; b=Bqhk18wSbtyo9rEq9qqOm45Rv4uvIyqaZ28tLts3mJ1XyMjz80tHw6eZXAsbUMRbtm YsOKLXU4D8P6ndYXGuEP/gZvnOgM00snEO7eqq9IzG+NDPdHQx7JwVTXrjYGC5Fm7tAS UBg2ziY4gZrygSx9LzDD3Z3o0V5UAUX3IlyZgvWFHWBxCq+Bp5asqsDWddpXWSMTVnSZ HLO1Ai4pcsLOOYCa/5qvHf9prmMQwsRUgL6zFuibwngBwajNrvLbdj5BTb4xbMUSV52z 5OsUhn6E7Mu0BjiQklFaeEc2gXf2lAPMwNyHL19PtQYWjwTj64B6Nrr6xUJSZWc0Zwff ECHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=HkVjCxb3t6ytaonp3kLCDVbei/+VDHkAiK+AmrSuWOI=; b=uAPTLqWBZmSr4ErRWEnadcVumUdzB4s6JHlKqGP9+D38toMvZR3ngmIA0GNTs3nL5d LrFh+IhuH4O12nOQHyt450bxL/KXSkC4/zPeUneoLXpirHA26O+OMOq/OeG55Om0rAm5 ygT8TfOvohoO48bcmqTErhoa1eczIDU+ZdMt5J38u+sQmF9ed4fhc6n29SXXsZ44OeeY 3PbLyx80VQYaofg4UxyQeMkj+z07YDxEIFYtVMDI3KKTbJcv1BisaPB4Najh5pZM1hDG O8YcRKUoJNk9oxbbUBBKihrj5B8L2k7dOMuvTkcBV+velhtmapX9KfD22xzVscv/koMl Rd/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NYCGelSt; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v8si33979435plp.215.2019.01.28.17.55.47; Mon, 28 Jan 2019 17:56:15 -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=pass header.i=@google.com header.s=20161025 header.b=NYCGelSt; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727022AbfA2Bw7 (ORCPT + 99 others); Mon, 28 Jan 2019 20:52:59 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:38800 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726965AbfA2Bw6 (ORCPT ); Mon, 28 Jan 2019 20:52:58 -0500 Received: by mail-wr1-f65.google.com with SMTP id v13so20230394wrw.5 for ; Mon, 28 Jan 2019 17:52:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=HkVjCxb3t6ytaonp3kLCDVbei/+VDHkAiK+AmrSuWOI=; b=NYCGelStrQBg6vXy1MgTHTQ68wlUTou+rnxUJ+Gfa5Hzag2YWMCFeZpkGSefgRrR0j Twafu7tdGbao19E4qQpGHgmi/phDGBSnPZfGMRKPiXuHlIbcDDJqhGKyBa6h0aefK5NQ fpOunwwDo3g+lJr/R835q65Bs9Gbwp+DbRcjEVoYp8myiyaKxtMjQuOpOsqjWQ0uyz8r 4WGd3gY+z1Ub+N/WoO6Fco+BIqngceXRNj6WULTc8vYNRaTQLUgYfhwnhzVZObLaQlwG 8g91c2/tfKbxhB/628gujkMMd/2NZXEwxtFzrr7nt/8eCfnD0Lpp1GaazGjD/SC8RKTm sRwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=HkVjCxb3t6ytaonp3kLCDVbei/+VDHkAiK+AmrSuWOI=; b=Pyf324EA24I7l15vBoP4fwj7afpkuilavs4QvAsD08ECEa1kgJp1yauw5uD7gZ9Dn9 Eyz9nnipFAOcbvqN3fpHbM3VskzsrKmkTqW3+0dr4Nxix92TTKfrmukVJrB4Xn8PfHl0 tIQE/6VqPM9iY4yBhu6TMsFlsf94PkIWn7K85CLSAVqYSMSSh5GAfsP3Arb2c2K4BiXN dg1LL6ya/66bK2ZE5tLF7dTfbIrTwmtyDsaWlLo2s6F3EWMqbvbW6AkEqNkywxE6vW/R 0BcQdIfT0VALptqosjB4qzRdFwZf1qmlH8wibGZ1kLMQVjvGIL/JpboKTj2AXQGlec2D YNeg== X-Gm-Message-State: AJcUukemc/P7z+batqxC9MvAXVRloaofVv6oLUKm34xVN8hQ4kUjLgDG TrQwqQHCnleWm/SVK9+dCUjth5LuhkJbw+ieUJIr/g== X-Received: by 2002:a5d:4e82:: with SMTP id e2mr23322149wru.291.1548726773198; Mon, 28 Jan 2019 17:52:53 -0800 (PST) MIME-Version: 1.0 References: <20190124211518.244221-1-surenb@google.com> <20190124211518.244221-6-surenb@google.com> <20190128235358.GA211479@google.com> In-Reply-To: <20190128235358.GA211479@google.com> From: Suren Baghdasaryan Date: Mon, 28 Jan 2019 17:52:42 -0800 Message-ID: Subject: Re: [PATCH v3 5/5] psi: introduce psi monitor To: Minchan Kim Cc: Greg Kroah-Hartman , Tejun Heo , lizefan@huawei.com, Johannes Weiner , axboe@kernel.dk, dennis@kernel.org, Dennis Zhou , Ingo Molnar , Peter Zijlstra , Andrew Morton , Jonathan Corbet , cgroups@vger.kernel.org, linux-mm , linux-doc@vger.kernel.org, LKML , kernel-team@android.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jan 28, 2019 at 3:54 PM Minchan Kim wrote: > > 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. Thanks for your input Minchan! This is very timely because I have to re-post ver 4. Will address your comments before re-posting it. > 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: > > + > > +