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 97F71C433FE for ; Wed, 11 May 2022 03:48:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0BB856B0073; Tue, 10 May 2022 23:48:16 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 067B46B0075; Tue, 10 May 2022 23:48:16 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id E71186B0078; Tue, 10 May 2022 23:48:15 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id D98CD6B0073 for ; Tue, 10 May 2022 23:48:15 -0400 (EDT) Received: from smtpin07.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id A269321F6C for ; Wed, 11 May 2022 03:48:15 +0000 (UTC) X-FDA: 79452079350.07.D740A23 Received: from mail-io1-f51.google.com (mail-io1-f51.google.com [209.85.166.51]) by imf07.hostedemail.com (Postfix) with ESMTP id ED5334007E for ; Wed, 11 May 2022 03:48:08 +0000 (UTC) Received: by mail-io1-f51.google.com with SMTP id m6so846522iob.4 for ; Tue, 10 May 2022 20:48:14 -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=8DfmonqPmvYWBc2QfJoYX1TyXXOUpf1yte699p2vRko=; b=c4ONip93EWQzvqAbNrC5br9qHeXBQotwUU/+5KtFhNPKs0hB+IhK/cPXNIhJ6bf+gz HTyItcafAX+evVodrDCAmEcII02ETvE6RVKHUV/EwSvbb6mwv2i7+duGWnnRexG9V2zm dLG3cOoVJaUktsvn2xeZwzf3byuxD31e43umqHPSJTjzpXg3wd78d7eUIAi2pSRR2uxa VphWkk86A6Mx+Y4upe/x9Cza7mmKeTsIf8Mu4Wq57pL28N6lbb2oku0BD1D5cybdKFtg riq51SeEyG0FBHpCmXhw2LBGqgogN5W7mnhULeFKMPidliiOMzC6LSf5LpJegE2Ws9Ir LHRw== 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=8DfmonqPmvYWBc2QfJoYX1TyXXOUpf1yte699p2vRko=; b=kWGWVHDv1oMJBZxd970B8sFcOSD9xHRovxJ4iQRow2aJqUHW6+4MDe/8Ltk7t7fJ7j 3YxOR5vHvr2dp4dlypK3vQyC+uVBkjIBrQ/GVHkLKBuoXvz7cAXhq/lT6thzqLAcXQNb zKp/Pysigfe7yvQl2ywpTesbogIg8rDLXhhlO+4zZ7Gbg6zf1/8okvBpmdbqA5uTreDu Qxzj5oHrOBtlMoj9I/FjxdLwECnNHLmfeiHsiQIwA+LwEdZN3434nIUnsVBLsVERviy9 U+8VBawryeU7bZ1W2eWaEsLymG3crAEvQisfitKu4jDzeKIdE0BCMcDqlca82YfJbzuj wxbQ== X-Gm-Message-State: AOAM5312IZ+fW/S+NdwHdrPP5hh3y5fkQUpMP7pHpd42dWnA66PKX6Ye 1dRy3Dr6/R5oDCwSUCZwxhfK98GMXW1EngF6nHQGtg== X-Google-Smtp-Source: ABdhPJxPihOz4blNUpIL17ddDVB8CFoB/qm+7zMHlOcvuky3lU+WyH29Z43+vdt4iPcQZ+5Shm5FpiCwa9+/LbEVpBw= X-Received: by 2002:a05:6602:20d9:b0:657:b18c:4a33 with SMTP id 25-20020a05660220d900b00657b18c4a33mr10123431ioz.82.1652240894214; Tue, 10 May 2022 20:48:14 -0700 (PDT) MIME-Version: 1.0 References: <20220507050916.GA13577@us192.sjc.aristanetworks.com> In-Reply-To: From: Ganesan Rajagopal Date: Wed, 11 May 2022 09:17:37 +0530 Message-ID: Subject: Re: [PATCH v2] mm/memcontrol: Export memcg->watermark via sysfs for v2 memcg To: Roman Gushchin Cc: hannes@cmpxchg.org, mhocko@kernel.org, shakeelb@google.com, cgroups@vger.kernel.org, linux-mm@kvack.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: ED5334007E X-Stat-Signature: eopgox1amjmwwaykym8uradygfii7rbd Authentication-Results: imf07.hostedemail.com; dkim=pass header.d=arista.com header.s=google header.b=c4ONip93; dmarc=pass (policy=reject) header.from=arista.com; spf=none (imf07.hostedemail.com: domain of rganesan@arista.com has no SPF policy when checking 209.85.166.51) smtp.mailfrom=rganesan@arista.com X-Rspam-User: X-Rspamd-Server: rspam08 X-HE-Tag: 1652240888-656868 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 Wed, May 11, 2022 at 8:18 AM Roman Gushchin wrote: > > On Fri, May 06, 2022 at 10:09:16PM -0700, Ganesan Rajagopal wrote: > > We run a lot of automated tests when building our software and run into > > OOM scenarios when the tests run unbounded. v1 memcg exports > > memcg->watermark as "memory.max_usage_in_bytes" in sysfs. We use this > > metric to heuristically limit the number of tests that can run in > > parallel based on per test historical data. > > > > This metric is currently not exported for v2 memcg and there is no > > other easy way of getting this information. getrusage() syscall returns > > "ru_maxrss" which can be used as an approximation but that's the max > > RSS of a single child process across all children instead of the > > aggregated max for all child processes. The only work around is to > > periodically poll "memory.current" but that's not practical for > > short-lived one-off cgroups. > > > > Hence, expose memcg->watermark as "memory.peak" for v2 memcg. > > > > Signed-off-by: Ganesan Rajagopal > > Acked-by: Roman Gushchin > > I've been asked a couple of times about this feature, so I think it's indeed > useful. > > Thank you for adding it! You're welcome and thank you for the Ack. Thank you, Shakeel and Johannes for the review and Ack. The patch has been picked up for mm-unstable. Ganesan