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 C1B44C433F5 for ; Fri, 6 May 2022 16:58:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 50B176B0072; Fri, 6 May 2022 12:58:43 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4BAEB6B0073; Fri, 6 May 2022 12:58:43 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3821C6B0074; Fri, 6 May 2022 12:58:43 -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 28DCE6B0072 for ; Fri, 6 May 2022 12:58:43 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id F33D761CE3 for ; Fri, 6 May 2022 16:58:42 +0000 (UTC) X-FDA: 79435927284.02.8361F4B Received: from mail-io1-f43.google.com (mail-io1-f43.google.com [209.85.166.43]) by imf25.hostedemail.com (Postfix) with ESMTP id 082BAA0038 for ; Fri, 6 May 2022 16:58:27 +0000 (UTC) Received: by mail-io1-f43.google.com with SMTP id e194so8674078iof.11 for ; Fri, 06 May 2022 09:58:42 -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=XWTjhUSRiiJ5D5xeSPG1i2N+aCGL4DIlcTBvSuCnzOA=; b=cd5TyiMoeqf2BDKbz7kRgMldmwWPKOKBKpsemkODGRSYflPuEZ9+V5n40O1ohehpws xIlTWNT5kydtFWKDaCIeh15fe7m8au3X8Pv2KhRm1shy7kueZFjlLql8sz7rVqCzeGTq 7T2YPJY5S8kcWamJj4501uG+U/44UYMbUkRI5YdfUoO+SwZB4y5jOmML8H9HR9NmqnJk vXJA/MU95YAqh9a93IlWJIrJIqDhvThF+YGV+lr9yZsPZB5evNUNGnyPM9zBub+8p2ET QZaTnl6hO8Z6Anf02kPhAVHMwPnb0ybASAlCE1faTEsuZxpHR1NTPmZXHTejVonqoGPX z/dg== 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=XWTjhUSRiiJ5D5xeSPG1i2N+aCGL4DIlcTBvSuCnzOA=; b=Lx4Vrdp3J1Y6GKSyd2qaN6cEvItgwjx0xwOGsDqHhNjng4VBJC/ZEUC8R9ez08YXiZ dvX8vxu53cf1cs4O6lQOSb2QGhRBZEMccWL+zjolGQYL8Qf30pTpkr/eUtw6f9dllWjj VNg/FR1Ltal4fb1uop0Bbh96lwfqPfiJPtLH+lNNb8evfIf4xu/BzeQgezcULvmepOOU dwdf1MqiFLbnBt1camK7dzqaySZJ1dOtPIpNqyyECwygHXWGpLb7aP4wjaM7UwYLbWMi BQnqlv8F2UJ/t0I0AQCgofthZJpl84cOMTyUFR0J0eyVeHXQekgy6ECWPynn7XhLzQoE /+Ng== X-Gm-Message-State: AOAM53008Dbjr/epei8R0VmUcEfC7aO0KRE9/BUsiTEi9neRVWqfEorv 71ze25gB4sGjFe/EQBIAZym4bsKqYUc52PPt+Af2KA== X-Google-Smtp-Source: ABdhPJzVKd8w9C9IOsw/b5K31cYrggfxxRKoLGbhtCdNnjz81Jg0JHRQsiJT484EvKqrc8ceRFRFH8sY5Bq/ZS16VRw= X-Received: by 2002:a05:6638:140d:b0:32b:c643:e334 with SMTP id k13-20020a056638140d00b0032bc643e334mr1479689jad.125.1651856321553; Fri, 06 May 2022 09:58:41 -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:28:04 +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: rspam02 X-Rspamd-Queue-Id: 082BAA0038 X-Stat-Signature: xau8sqhzk4dpyfg7945pagmiqh46g3f7 X-Rspam-User: Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=arista.com header.s=google header.b=cd5TyiMo; spf=none (imf25.hostedemail.com: domain of rganesan@arista.com has no SPF policy when checking 209.85.166.43) smtp.mailfrom=rganesan@arista.com; dmarc=pass (policy=reject) header.from=arista.com X-HE-Tag: 1651856307-463439 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 Fri, May 6, 2022 at 10:15 PM Shakeel Butt wrote: > > 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. Sounds good. Thanks. Ganesan