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 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92FD5C433EF for ; Fri, 6 May 2022 21:04:14 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E80B56B0071; Fri, 6 May 2022 17:04:13 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E2EFD6B0073; Fri, 6 May 2022 17:04:13 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D1D936B0074; Fri, 6 May 2022 17:04:13 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id C05036B0071 for ; Fri, 6 May 2022 17:04:13 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 8FC6F3027F for ; Fri, 6 May 2022 21:04:13 +0000 (UTC) X-FDA: 79436545986.09.1C79A1E Received: from mail-pg1-f179.google.com (mail-pg1-f179.google.com [209.85.215.179]) by imf10.hostedemail.com (Postfix) with ESMTP id EEBEBC0021 for ; Fri, 6 May 2022 21:03:54 +0000 (UTC) Received: by mail-pg1-f179.google.com with SMTP id q76so7001989pgq.10 for ; Fri, 06 May 2022 14:04:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=0/GiMZkwziqGVKRswzEq3KwN0WZ0d2CZmkLA7V2xges=; b=rLijwaVPAMsRydy7EXWF4RLC/0NsdSSaCfI/QiICpS/c5u8iUKncH59HRzLuoFhl0M WF+udOYUKCFKzaw7r4wqvM08AqPTC3aInhgNle06I9Dcn5wOpLqW5/OVm9klyCcvVUre yS4VfOh9A6/Y2BEBeviTklCXMYTmDelnOP97hySBEICezb6xFanRb7fzTqclHrraw9c+ lfImj5dXVX7gMDnMNB3agTiCY4S+n4tVeUarOaMkn/+28nfy2LFr594ysBdYPmWZBZYU G6VZmjkgkJ4gjPBQdrbPwVU87/4Q/pYxrrcmVDkafSpBsvsl0ezEUrgDC4DUuuvs9BXU Dufw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=0/GiMZkwziqGVKRswzEq3KwN0WZ0d2CZmkLA7V2xges=; b=5vgpf87qF+uNhTvqSPDYGuqDxs9JxKobmZnVVQJE7Ez7tnVWW13SaRoIDrD2wyAekz eZKESafZ/71xktoAXtiKb0RoIzQnjTU7DZxrnVO5TjdeTa+D+gtcl8P5lP3dh0Wr3wDT zI8OmshpWXQzILf3zGrvEzOyKWQexi15MCGcu4ZA9a0Andqn1opYxtVROO+wL6H7zUkj T+iPyLiFNvAR6oF65QytZ5P3uid8skoA38wGs18wwi7f0+5E5Bk+1wmUx9Vbq/eurYOE UTroiaFs+YCrU7oOh1fSC3+/kx+6jluevCZtivkLZSjcuhR5NhlWnStjoAFTy5NRznKb FJCA== X-Gm-Message-State: AOAM5337EH1oBTfNzPsYtud/ES27jdLN3amdC37eYTkpV8yp59R55UHW x4Akf6nVtAUtoPFpQ/qJrk+88J7KKnRPijoOrMbsLw== X-Google-Smtp-Source: ABdhPJxroGIi3ECGLBHZLWXn+a5SRECWfWcZa0be3+Zrt8x/nte5b7bF+HWtbZ5kJM6MkPqHl9rTXQsaZYBO1Ykc0ok= X-Received: by 2002:a63:382:0:b0:3c2:1669:e57b with SMTP id 124-20020a630382000000b003c21669e57bmr4267599pgd.509.1651871051869; Fri, 06 May 2022 14:04:11 -0700 (PDT) MIME-Version: 1.0 References: <20220505121329.GA32827@us192.sjc.aristanetworks.com> In-Reply-To: From: Shakeel Butt Date: Fri, 6 May 2022 14:04:00 -0700 Message-ID: Subject: Re: [PATCH] mm/memcontrol: Export memcg->watermark via sysfs for v2 memcg To: Johannes Weiner Cc: Ganesan Rajagopal , Michal Hocko , Roman Gushchin , Cgroups , Linux MM Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam10 X-Rspamd-Queue-Id: EEBEBC0021 Authentication-Results: imf10.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=rLijwaVP; spf=pass (imf10.hostedemail.com: domain of shakeelb@google.com designates 209.85.215.179 as permitted sender) smtp.mailfrom=shakeelb@google.com; dmarc=pass (policy=reject) header.from=google.com X-Rspam-User: X-Stat-Signature: r5i3ooug7t1k8kegp8bfq8q5u7b6krnb X-HE-Tag: 1651871034-451808 X-Bogosity: Ham, tests=bogofilter, spamicity=0.001542, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: On Fri, May 6, 2022 at 1:50 PM Johannes Weiner wrote: > > On Fri, May 06, 2022 at 08:56:31AM -0700, Shakeel Butt wrote: > > On Fri, May 6, 2022 at 7:57 AM Johannes Weiner wrote: > > > > > > On Thu, May 05, 2022 at 05:13:30AM -0700, Ganesan Rajagopal wrote: > > > > v1 memcg exports memcg->watermark as "memory.mem_usage_in_bytes" in > > > > sysfs. This is missing for v2 memcg though "memory.current" is exported. > > > > There is no other easy way of getting this information in Linux. > > > > getrsuage() returns ru_maxrss but that's the max RSS of a single process > > > > instead of the aggregated max RSS of all the processes. Hence, expose > > > > memcg->watermark as "memory.watermark" for v2 memcg. > > > > > > > > Signed-off-by: Ganesan Rajagopal > > > > > > This wasn't initially added to cgroup2 because its usefulness is very > > > specific: it's (mostly) useless on limited cgroups, on long-running > > > cgroups, and on cgroups that are recycled for multiple jobs. And I > > > expect these categories apply to the majority of cgroup usecases. > > > > > > However, for the situation where you want to measure the footprint of > > > a short-lived, unlimited one-off cgroup, there really is no good > > > alternative. And it's a legitimate usecase. It doesn't cost much to > > > maintain this info. So I think we should go ahead with this patch. > > > > > > But please add a blurb to Documentation/admin-guide/cgroup-v2.rst. > > > > No objection from me. I do have two points: (1) watermark is not a > > good name for this interface, maybe max_usage or something. > > How about memory.peak? It'd be nice to avoid underscores. > > > (2) a way to reset (i.e. write to it, reset it). > > We used to have that with cgroup1, but it gets weird in modern cgroup > environments when there can be multiple consumers. One of them resets > the stat for their own purpose, now the others have no idea what > sample time frame they are looking at. > > It'd be more robust if we just said "peak usage since birth of > cgroup". If you want to sample new work, create a new cgroup. SGTM for both.