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 9FFC3C433F5 for ; Fri, 6 May 2022 16:44:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EE06F6B0072; Fri, 6 May 2022 12:44:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E68636B0073; Fri, 6 May 2022 12:44:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CE0B66B0074; Fri, 6 May 2022 12:44:34 -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 BAB5C6B0072 for ; Fri, 6 May 2022 12:44:34 -0400 (EDT) Received: from smtpin10.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 979EE21D6A for ; Fri, 6 May 2022 16:44:34 +0000 (UTC) X-FDA: 79435891668.10.79BF113 Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by imf31.hostedemail.com (Postfix) with ESMTP id BFBC12004B for ; Fri, 6 May 2022 16:44:16 +0000 (UTC) Received: by mail-io1-f43.google.com with SMTP id e15so8662790iob.3 for ; Fri, 06 May 2022 09:44:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=arista.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=rf6MstebMe7T6JVzKugNQZXbfltXJvPfsmUp0B3hsoU=; b=jLKEUboD2FZQ+ozGu1TE5ymLn9dqAn0Bx9eCyPK4k4XzsSowz7l1Tu+xTPMtrNQnrJ 5PMtkEBS2y9k7znDr40M9XVMkGT0WY4buCZXvqkzxQ24mfD3fryn7YU2x5QF9M6yiGoc e859cuJ8QyOyyCeHYO5nZDtFGKemBTz+mEzDFzKYJsD7uvIT6T8NzsTgxtwbKU6ZY8+o u8Zfs+54nAd2M7uE2a+YcgDsogj101IGxjdRFN9R90V47eU5fBkXwA7P70wkJ5sTWOPa 33m6cWGxvXhXi9tAirtlAA/VRmQEDxJOIuxjELqRuV1spKd28xyFmPCCnUc7AMOKmknx rO2g== 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=rf6MstebMe7T6JVzKugNQZXbfltXJvPfsmUp0B3hsoU=; b=JVaT/3Y/LMd4Lnre+mhzBOQSZ/LIok7SjCxs6hLyD8fNMjc9m6/a0v7FrNQk7sNhE3 ctbAcGtBkeRA0FxJ1Oa5FKW2oEJDphQip3IKZxGU+9GKiEUYu9GR6I6lOnJlLdRir7Ot i0VkBPD2Tehttbsk/+HF70F4xwLsMWrtA9+mmCqAI+igax+MDs+tZBa9Scg8/790ouqh 74VmnYVkQFeiR4HJAv6eADd3pba7SX44uSbAWXD75/nX65KkN9sTb5XZMdmYN5ViqEo4 Lp2zxjQkg7L0rABxQ5m9DI4jDVcoOnyPYRN6/lquJVyFRnZQcEc5cV7kwVbpCDmuFqAs 7WJw== X-Gm-Message-State: AOAM53151ZV44e+CTPmgKfLGGONW72EPjDZbj60W48nYCyo6KFJLfavt mKd2voyBnsAuHDWS6KDrFp3M7NQrxIWF7fGPFZLv9w== X-Google-Smtp-Source: ABdhPJz2u6m5hAYSsmxG9e0+Du1A2gIfpf8+OxpNfiG4XrO2h9NmVgW90gOouinrKG+A4QcfsQT0uIhGPHJF8YEK69s= X-Received: by 2002:a02:3b07:0:b0:32a:efae:69ce with SMTP id c7-20020a023b07000000b0032aefae69cemr1729776jaa.275.1651855473373; Fri, 06 May 2022 09:44:33 -0700 (PDT) MIME-Version: 1.0 References: <20220505121329.GA32827@us192.sjc.aristanetworks.com> In-Reply-To: From: Ganesan Rajagopal Date: Fri, 6 May 2022 22:13:56 +0530 Message-ID: Subject: Re: [PATCH] mm/memcontrol: Export memcg->watermark via sysfs for v2 memcg To: Shakeel Butt Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Cgroups , Linux MM Content-Type: text/plain; charset="UTF-8" X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: BFBC12004B X-Stat-Signature: n59jb6zopix1ynkac8mj46fzcg68acdo Authentication-Results: imf31.hostedemail.com; dkim=pass header.d=arista.com header.s=google header.b=jLKEUboD; dmarc=pass (policy=reject) header.from=arista.com; spf=none (imf31.hostedemail.com: domain of rganesan@arista.com has no SPF policy when checking 209.85.166.43) smtp.mailfrom=rganesan@arista.com X-Rspam-User: X-HE-Tag: 1651855456-904961 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000009, 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 9:26 PM 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. (2) a way > to reset (i.e. write to it, reset it). Thanks for the feedback. I'll post an updated patch with your suggestions (including updating the description). For resetting the value I assume setting it to memory.current would be logical? Ganesan