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 5C9FEC433F5 for ; Fri, 6 May 2022 16:45:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CBB726B0072; Fri, 6 May 2022 12:45:39 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id C6ADB6B0073; Fri, 6 May 2022 12:45:39 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B0C086B0074; Fri, 6 May 2022 12:45:39 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from forelay.hostedemail.com (smtprelay0098.hostedemail.com [216.40.44.98]) by kanga.kvack.org (Postfix) with ESMTP id A2C456B0072 for ; Fri, 6 May 2022 12:45:39 -0400 (EDT) Received: from smtpin26.hostedemail.com (10.5.19.251.rfc1918.com [10.5.19.251]) by forelay05.hostedemail.com (Postfix) with ESMTP id 63A12184B5029 for ; Fri, 6 May 2022 16:45:39 +0000 (UTC) X-FDA: 79435894398.26.21DAFC6 Received: from mail-pj1-f50.google.com (mail-pj1-f50.google.com [209.85.216.50]) by imf21.hostedemail.com (Postfix) with ESMTP id CDFE91C000D for ; Fri, 6 May 2022 16:45:32 +0000 (UTC) Received: by mail-pj1-f50.google.com with SMTP id p6so7511150pjm.1 for ; Fri, 06 May 2022 09:45:38 -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=W0qjQRp9Z/ELa1KDMTyNkwvprvSvj/CRsN770m3dHtI=; b=aUldgzo43Llu6fp+QcMUGWFDlh/AyY99U1PEBR6mCdKVOwYQgufPrs60jh9yYF9clN Y2SCgGEm4ZYa+Bc5GnirgHFD0s8IdkDJC++bblgND/WLFVrPoOvwUURePx3LjUnlQk2A IitvA2tVFh80xwQvC6s3hyFSCUkrTwic4OftTnQpgLtQ/TnM5laCtMUn6ZMVcbxdEwyW 5WqZPNGAZTtVraVeINBMqdUXSD+EgWQotbgbf4u2zDRUD4NExne3Lyu8wKc0nwJXl+at o9Zu6gqgA9kTdOUmy5Mo6H03U2WlteuyDkZzf4u0TP66ODku6KIQirqBxbgwhSTmP3Qu b4PQ== 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=W0qjQRp9Z/ELa1KDMTyNkwvprvSvj/CRsN770m3dHtI=; b=2+oNB7mqjFTdetgp3TUjV/n0B4aSvd8FATVL6zD0lBwlVuw+HohNfPvTjxriXGFDiH aVze/kSmbfm7imdAn1AN/Ar1RsT6rAEwIA/7QOi32aIfucnEwZM9vEziipeCaGjsvV5l Z6WT2ijUWImiBRSMUddlsPXS7FdVpyRzcFpYK29NcG8lEXv3mvV59QTU3/8YYXUuj68Q Cv5E8QGlEs22OA0qYeXQQDoRUHLpfcm2GlrA8KuaspVtXzxWFWAc9pxK69wxr8bMeipa XW0/T+8H4lVS4Dqpxn84rWO6wKSUsDYx32YithOogPkc/nnGumgh0HGZ2voqrZzXNqY8 AfsA== X-Gm-Message-State: AOAM530LlQ8V4r1Rsh1B8ERCVzWHRe35l3zYQf0ArYvR3Qis2MNLFUrF LLksYO1thKg6/zl3FIDXI6ty8AfJHSX5kai75ExeRQ== X-Google-Smtp-Source: ABdhPJw6uS6rcXL4dRNcjuHFRhi6WbGIuTBUz7jZ2LbGjjGzT1siQj8ASOYOjv0f+6Eh1eHAFhCe2kM68F48f0UwCoY= X-Received: by 2002:a17:902:f682:b0:15e:951b:8091 with SMTP id l2-20020a170902f68200b0015e951b8091mr4494936plg.106.1651855537669; Fri, 06 May 2022 09:45:37 -0700 (PDT) MIME-Version: 1.0 References: <20220505121329.GA32827@us192.sjc.aristanetworks.com> In-Reply-To: From: Shakeel Butt Date: Fri, 6 May 2022 09:45:26 -0700 Message-ID: Subject: Re: [PATCH] mm/memcontrol: Export memcg->watermark via sysfs for v2 memcg To: Ganesan Rajagopal Cc: Johannes Weiner , Michal Hocko , Roman Gushchin , Cgroups , Linux MM Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: CDFE91C000D X-Stat-Signature: 4quafzs4rkz9ccwgagqredez9caeumtj Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=google.com header.s=20210112 header.b=aUldgzo4; dmarc=pass (policy=reject) header.from=google.com; spf=pass (imf21.hostedemail.com: domain of shakeelb@google.com designates 209.85.216.50 as permitted sender) smtp.mailfrom=shakeelb@google.com X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1651855532-691585 X-Bogosity: Ham, tests=bogofilter, spamicity=0.012017, 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:44 AM Ganesan Rajagopal wrote: > > 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? > Yes, that is what v1 does, so no need to do anything different.