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 585B6C433EF for ; Wed, 11 May 2022 02:48:16 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B7F666B0075; Tue, 10 May 2022 22:48:15 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B2E3E8D0002; Tue, 10 May 2022 22:48:15 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9F5EF8D0001; Tue, 10 May 2022 22:48:15 -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 92E6B6B0075 for ; Tue, 10 May 2022 22:48:15 -0400 (EDT) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 66C9781CF7 for ; Wed, 11 May 2022 02:48:15 +0000 (UTC) X-FDA: 79451928150.20.756C9B5 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf05.hostedemail.com (Postfix) with ESMTP id 10D131000A4 for ; Wed, 11 May 2022 02:47:56 +0000 (UTC) Date: Tue, 10 May 2022 19:48:09 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1652237293; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=uCnHxA7VpNijHGZNPJZUZ6oyRd7F+wjYsYtPWkS284E=; b=YUkOxIn+iOIzqbWiDTczG6RZIgmXSq88F65gW7aErpPupXjtoxJkrn/v0BLLzbivYUF7ob UfVf95n+NEMD1wM3k2Cvk7UZIFviS7lowrLBFMWS978ZvlGZUp9mdxQ/aWfAHMAgZgNjPI ZQmZTRAjYwAh838fjKkYcv5z2fExAuc= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Ganesan Rajagopal Cc: hannes@cmpxchg.org, mhocko@kernel.org, shakeelb@google.com, cgroups@vger.kernel.org, linux-mm@kvack.org Subject: Re: [PATCH v2] mm/memcontrol: Export memcg->watermark via sysfs for v2 memcg Message-ID: References: <20220507050916.GA13577@us192.sjc.aristanetworks.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220507050916.GA13577@us192.sjc.aristanetworks.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: 10D131000A4 X-Stat-Signature: 1ytfbf1hxf98nm6rofzecocsoyjbaziq Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=YUkOxIn+; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf05.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev X-Rspam-User: X-HE-Tag: 1652237276-355652 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 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!