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=-14.6 required=3.0 tests=DKIMWL_WL_MED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_PASS,USER_IN_DEF_DKIM_WL 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 DAD8BC282CD for ; Tue, 29 Jan 2019 01:52:58 +0000 (UTC) Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.kernel.org (Postfix) with ESMTP id 5C90721738 for ; Tue, 29 Jan 2019 01:52:58 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="NYCGelSt" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5C90721738 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=owner-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix) id D100C8E0003; Mon, 28 Jan 2019 20:52:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C9A318E0001; Mon, 28 Jan 2019 20:52:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B3BC48E0003; Mon, 28 Jan 2019 20:52:57 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) by kanga.kvack.org (Postfix) with ESMTP id 31E308E0001 for ; Mon, 28 Jan 2019 20:52:57 -0500 (EST) Received: by mail-wm1-f72.google.com with SMTP id 18so5239192wmw.6 for ; Mon, 28 Jan 2019 17:52:57 -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:mime-version:references :in-reply-to:from:date:message-id:subject:to:cc; bh=HkVjCxb3t6ytaonp3kLCDVbei/+VDHkAiK+AmrSuWOI=; b=un52MTua7aIre309Kfnt1vYFZWCDL98ubQNZtlr0JAmEDGKXe2lzwdmRHjKBKweXTk tWtNfLvxbAU2QLbDor9qz/Whh9uPQucRvmoopdETja2LzSjy4p7IPjeR2IYHGL7k8NSb Lz4hMUc4fxeB0BKSYteEqnfeB4z/g8XR4lVNEwU6sAfP3WQG4bEHEWLD0PcaWPVAT6d6 iY9xVPpMcFiLWqQppBU0asMJUgQRxH+e0devCBzlr8Q1X3vWZlK54pc067tbe6McUdhT 6XbKMqnys2/HE0c+yD6IsEaXRt5Ww5eetSkdBWfPSXYulK3KcPsuB8u41X2lhHT33vJn taDg== X-Gm-Message-State: AJcUukcko32GR0P6tzsFe1Dh7j+moQrzVziRAUOZhexYuh4pR0aHHJJU z60ywn0fVP9g0tzaYNbiIj6P9zPWE9tLcAIYYT3XdI2UTbzKSTcgiMtEi8D2to1FaaYKoEa9lE4 wH/MozK6vrCC/5skhVlE/lrGssyZpHxtDOWH9q+0p+i1rAnwSalcDEmS7PJSI8ZpeH0y7Q7w3LH DlMOh3sdYh6VqkNXKpfYP/dLcCiugIA6+l43ebPbg7WkGxnOGGkmdQSbUfvwyTg8+rnhB6nevXd LEcn6sv3YztfL+kJrRxSqx0v3mtG23rMf1VvPR6gSMuYZylyZYpFrHEs13hH4QiPa+l1FowBLOy ZFZJWeFmZV4ZDoRIiFFTigLTA1eiX29bnLuw93byqB0X/ecVC5c4rsK5BW5JhqdPLLHhyOhk9as G X-Received: by 2002:a1c:a4c4:: with SMTP id n187mr19285867wme.15.1548726776488; Mon, 28 Jan 2019 17:52:56 -0800 (PST) X-Received: by 2002:a1c:a4c4:: with SMTP id n187mr19285777wme.15.1548726774213; Mon, 28 Jan 2019 17:52:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1548726774; cv=none; d=google.com; s=arc-20160816; b=yQcCuwHYQGIIJU0iNcd8LqhINdAGGcaZolHL98BqXOGeXvab4t2b9QDdb3ZC9DldUT mm9KERL73TsnwPBZm4CH9PJ8dQ7Hm3noTnLTCPX368m5lVseI2T5w3+evmEYdEg2H2+7 /lA9orZnB9GCWoC8axKkNqDXeSyAunq48wg+r2s669CCUjlz7aonCgJdvwC6+3ZzRSXj gW9c9XD8u6FEwTRLbzCBs2BrZ7FTsyIR2W1hSHzdddJPnO8Zli6ABfEB7Rf4HD3Y4L2s A2XIqEzJzGo3R6MWYVHunuc9u9VX5LZezCMjnXrum1XRvEAbNAVcDyWoW9W0qGJWu0fk xdSQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:dkim-signature; bh=HkVjCxb3t6ytaonp3kLCDVbei/+VDHkAiK+AmrSuWOI=; b=FYLA7T5hB2hKi730m7sOaeuDklywkRbzleKSK7beRc+X6hr9s6/lW/4RuuIMr9p5M0 8i7ghXdBMOyM7XkzK+cKPaD8sQvUvEf5TYce5fo7sxUuQVXIyaNbMXE0zk964lH//6GJ Zzr1XeYBZoGPB/IY0NZFsu5bhOb+ORpTetS4yjrAdq40lXP06ikwzKkpLUEn6fN1LzBK /cch25axTXhu/Bu/j+IDMCsVmHr751F07v+KqIsAD5a70p92NHTKD/9u4K28uY0LyNHA RBOzR9fT2YXHAFuDSYWWl9SIoGjFot41H11VzaSE2alZPHglxoaYq13Hx7z3wn4raH8Q XajQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NYCGelSt; spf=pass (google.com: domain of surenb@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id o4sor79823894wrj.2.2019.01.28.17.52.54 for (Google Transport Security); Mon, 28 Jan 2019 17:52:54 -0800 (PST) Received-SPF: pass (google.com: domain of surenb@google.com designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=NYCGelSt; spf=pass (google.com: domain of surenb@google.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=surenb@google.com; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com 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-Smtp-Source: ALg8bN7dJUD3O0zT8z8sjABWjlJGmb8nFioVcF4XxjgvyYuES17zOjpIZGLzXVOZgTlOse4hx0AIhn/4e/zcMeRG540= 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" 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: 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: > > + > > +