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 B2E31C433EF for ; Fri, 6 May 2022 20:50:38 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 11FFA6B0071; Fri, 6 May 2022 16:50:38 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D01C6B0073; Fri, 6 May 2022 16:50:38 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id ED9BA6B0074; Fri, 6 May 2022 16:50:37 -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 DF88D6B0071 for ; Fri, 6 May 2022 16:50:37 -0400 (EDT) Received: from smtpin14.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay12.hostedemail.com (Postfix) with ESMTP id BCE4D1212E9 for ; Fri, 6 May 2022 20:50:37 +0000 (UTC) X-FDA: 79436511714.14.9D62B14 Received: from mail-qk1-f173.google.com (mail-qk1-f173.google.com [209.85.222.173]) by imf13.hostedemail.com (Postfix) with ESMTP id 3DD6D20027 for ; Fri, 6 May 2022 20:50:23 +0000 (UTC) Received: by mail-qk1-f173.google.com with SMTP id 126so6764340qkm.4 for ; Fri, 06 May 2022 13:50:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=kM1Re2q1+o0mt7HNTzM9pmXb6Uv+LgAUNdOExkGF+Sk=; b=nCHZ2VjR2LksJL8hdsGYZ4YP8kaLy7y7F6GQMdz9S/7UTbw/6qCJQA9cmKW5G4fvEK /nrOkjPS9aulj5o7hdS9zR69R2yovdEm6GdgAtRvQfFTBhvcYYGrIBZxKRcrQsHfKt59 PWcTPtpYxK+8sL58NOSDkbq4jtTVF8o0O7MVP55ECx2Vnwk7dNRqhxwAIsgFEYqluaaR 7U2Ed+uAGYvDnd36Aem7eflCHJ5Fnmp5OYyhPx7RJzCyWZQvuRVxqnKlpNTwIhr5P5MQ k7YzRaQHr5ptE/nQqk/ADvfd7lOXxDdNS6xmjkb2dY0GhfS+HZ1cl8yCexk56ZIB12d5 Il/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=kM1Re2q1+o0mt7HNTzM9pmXb6Uv+LgAUNdOExkGF+Sk=; b=4a/WLZPWXWL//ZocvZAXIP6ZPTynTwqfZFq+FvOCCXfPvyRin9nxamXOPB0/kyj7ul 93sSDFj7VXGdM8XrraXF8nHbXxS0NI+X8l97QCf47uEdFHPqMi8NVECs1k1I3pPZmR32 fRBI7okfC53E5GtfrZACVWnIi16K+gX3B2nO9I13QfU0vdoMD7KBPMZONR1cLL6zOsTL zl9tiI8V9cmfDl4GSJ+T/POCkkg97gyvVtTS1JOJAd3Rkad+u625ejhb9PK+aY7il7Pl IJCeoK/mHQKWMUJCklV2Hr6wqNeXdE2q8z6WhhW3hWchKD3O4beGsvX9m4pRNxxfTW7Q KBSw== X-Gm-Message-State: AOAM533bAVvFTQVEMYn44M6IdPGdb+SQZc0v316C5FU9B3SwFot1mx5x YG6bcN0w5Vo6aXJpRLCUBymV4H6G9rshIg== X-Google-Smtp-Source: ABdhPJwz1fDLm1s6qehStx74QYuE7hT/C4Zr9EzZiDpYQAVy+OzmK2UclNs7slFeMc5XkYwg6ibmPg== X-Received: by 2002:a37:5584:0:b0:69e:d812:4b4f with SMTP id j126-20020a375584000000b0069ed8124b4fmr3707452qkb.45.1651870236219; Fri, 06 May 2022 13:50:36 -0700 (PDT) Received: from localhost ([2620:10d:c091:480::1:538c]) by smtp.gmail.com with ESMTPSA id i22-20020ae9ee16000000b0069fc13ce1e5sm2937032qkg.22.2022.05.06.13.50.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 May 2022 13:50:35 -0700 (PDT) Date: Fri, 6 May 2022 16:49:41 -0400 From: Johannes Weiner To: Shakeel Butt Cc: Ganesan Rajagopal , Michal Hocko , Roman Gushchin , Cgroups , Linux MM Subject: Re: [PATCH] mm/memcontrol: Export memcg->watermark via sysfs for v2 memcg Message-ID: References: <20220505121329.GA32827@us192.sjc.aristanetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 3DD6D20027 X-Stat-Signature: pzbd7946k781ke9b4i1hjubkkoumgfep X-Rspam-User: Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=cmpxchg-org.20210112.gappssmtp.com header.s=20210112 header.b=nCHZ2VjR; spf=pass (imf13.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.222.173 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org X-HE-Tag: 1651870223-794305 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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.