From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roman Gushchin Subject: Re: [PATCH v2] mm/memcontrol: Export memcg->watermark via sysfs for v2 memcg Date: Tue, 10 May 2022 19:48:09 -0700 Message-ID: References: <20220507050916.GA13577@us192.sjc.aristanetworks.com> Mime-Version: 1.0 Return-path: 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= Content-Disposition: inline In-Reply-To: <20220507050916.GA13577-pF7uKtACKh3GmWBmRUYTj5O0Dwfk+90YVpNB7YpNyf8@public.gmane.org> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Ganesan Rajagopal Cc: hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org, mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org 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!