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 CB862C36010 for ; Tue, 8 Apr 2025 22:23:03 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id EEA72280034; Tue, 8 Apr 2025 18:23:01 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id E982C280030; Tue, 8 Apr 2025 18:23:01 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D5EFC280034; Tue, 8 Apr 2025 18:23:01 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id B86B2280030 for ; Tue, 8 Apr 2025 18:23:01 -0400 (EDT) Received: from smtpin16.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 78343C0596 for ; Tue, 8 Apr 2025 22:23:02 +0000 (UTC) X-FDA: 83312303004.16.71FC6CD Received: from out-178.mta1.migadu.com (out-178.mta1.migadu.com [95.215.58.178]) by imf11.hostedemail.com (Postfix) with ESMTP id 8F99C40002 for ; Tue, 8 Apr 2025 22:23:00 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=TcoBLalr; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf11.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.178 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1744150980; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Vzxu9RqZfgCag2kaUjY8CYVmo1wIXtQPZ42lCWTw8iY=; b=KUyQXUeKI8V9cxZL6tljmknJLGTHob8BDN0GxKrj9xxAdKQyCVkpk+rRSD2B7Nxgw9EEeJ BXr5CKmEQj7YyzRyWZezsYR+Ej4hh4QHFXUxW7O8ykmdLXVQqUfE3thzQy7/jjU7lNUUn4 lNkj/MVL1GkvHT+h6dC31ZT8UX7QcME= ARC-Authentication-Results: i=1; imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=TcoBLalr; dmarc=pass (policy=none) header.from=linux.dev; spf=pass (imf11.hostedemail.com: domain of roman.gushchin@linux.dev designates 95.215.58.178 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744150980; a=rsa-sha256; cv=none; b=Ls1Mv6TbQeYvgC0Brpb5rdiiRKDmjHinFmW+nkDYDw+ckFz7I9kpoDUdYb6nXafZNdMxRm KqmgR7GnJU0DgCUXpmTlFPjhfPIzNalHjwwG51824wOfYIQWSHq3AoSlueLioiuj5FOAOA 2nYgyISTD7cQgw7CLQe8LzRodI7K2QI= Date: Tue, 8 Apr 2025 22:22:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1744150978; 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=Vzxu9RqZfgCag2kaUjY8CYVmo1wIXtQPZ42lCWTw8iY=; b=TcoBLalr58CwOZhSnic9nJcluUplJlVYgdbXYy86g3MFATiR2nLoyxOIfXJzq6VYNDHRNN Nh7H7/+JYKH03Mw4gmcNyLOTeYpIIUGATAk4J2BXOGw1+NzorwG7tkExOmInn5G61Sc99w QBt34DnligOA4US0OCv1a5JNq63JjSM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: Waiman Long Cc: Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , Andrew Morton , Tejun Heo , Michal =?iso-8859-1?Q?Koutn=FD?= , Shuah Khan , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH v3 2/2] selftests: memcg: Increase error tolerance of child memory.current check in test_memcg_protection() Message-ID: References: <20250406024010.1177927-1-longman@redhat.com> <20250406024010.1177927-3-longman@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20250406024010.1177927-3-longman@redhat.com> X-Migadu-Flow: FLOW_OUT X-Rspamd-Server: rspam11 X-Rspamd-Queue-Id: 8F99C40002 X-Stat-Signature: m4gmkc5ic9kxweq5r5bdujg9fiztb66x X-Rspam-User: X-HE-Tag: 1744150980-303386 X-HE-Meta: U2FsdGVkX18CX/QeqSPzBS0uBSOUOaJAacU/2iWQbFH9fLa2TB+LhOuZgNvtQ+UPtu72ll2Hl/F2vnZPumu2iSH3pIsaNQHNxWOXsLOPBnKOyWJ7KgAk2yAUv0A1+2DTUVxnYTdOlLoCSywIfysqgRvbA2xrPB+Kg3bAEC5odpWr7r6OW+rMOxgaE2LB5zLCYoTfflZkR0FSVssEGnUXF0k1q0aYKraVdQq4fdm/TTVY92iQx+LrfAcKEa1xFYA5INXf9LyAHR6mepVDfGOUWYtkikK4TqvK+SnkPaJY1S0CEMvvG0Xx9exD/DKnY3FgEP/CgpOx6Aw65kWy4gjp+vgN8OxcvdRzSEgofbl+VoOTI1fBdbHhk1yxtAM95G3l9Df0lET2CMnHhDXNRQ8Ryh795R8Ed7hY5WHeePf/vzXQwUqFeePLkLbl0i3eTz8aMzugQqa8RkpTs8O/PzIeDYlUxebICrsAKx1KGylLMdA0PIGfcMI2KFDH78eK8lR/jF/AZV/Y2/YS8YUdy+RhjC6Ok4GfwPsTkKR4BjOv3J2j/YNXa/PIA4GDL0YTzO/GGEHQw3qSYZrb18hJD8SOw5d1MNsM5Jle8jdSOWjqQsGTT9t7IjlzAdoLS7UIV0Rqbv7FH5oe6VulBgjaU0O6u93qmBTkp8HbO7wG4yp+/GRCC1k6Awm1DE+J0sq2+lEorJ7/kP34qBMwcWHPY2krqxq8oJO5iBvCp2+ygYFpAXqAKDJQkqB3RwSa+MZej0+PpWeCA4+iQ6q84l8YujbFhHmXxPrgCzX+WrsjHBxSvuCi2bAc1r6diyARlGdaRwE3OBnLfy+b4dgzDyJ+Tb4ScOgcapsTUyIpFyY43bPaI6XN/NkI6sa9p5eR8Je6IAb1n0zalUU1T6809p6JqBbq7Ei9AGMdaMDGMfkKw/JJWroMcwfNWp9mBra8vtILGNhy27iToHKB/X7peJaVjFQ xptIyUyU 8Ynm12buYk+azu5hAN/VyYMwMTLJ18iik6H2H5UWI4AZNHsFrXbc5loSdlxJUBa0DaavYEtIp5VUomEXeHRqySP8LQv0u9lLfk2TkeqIHlcyKznbH1YuiAFhx8hbQLWT+Yz4AhHWCqzBBB1bE5jF825ipDUSYKcTv6pHxsRSYiiLdcKAalS5jkHG9BrRahXyPdw3mqwOMpaxfm/G07+HhFFYf0wG3/HgSj4BvqfYhdt9foXKx8aTR13UiqqVv/q/O6oR0RSjTzexp0rY= 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: List-Subscribe: List-Unsubscribe: On Sat, Apr 05, 2025 at 10:40:10PM -0400, Waiman Long wrote: > The test_memcg_protection() function is used for the test_memcg_min and > test_memcg_low sub-tests. This function generates a set of parent/child > cgroups like: > > parent: memory.min/low = 50M > child 0: memory.min/low = 75M, memory.current = 50M > child 1: memory.min/low = 25M, memory.current = 50M > child 2: memory.min/low = 0, memory.current = 50M > > After applying memory pressure, the function expects the following > actual memory usages. > > parent: memory.current ~= 50M > child 0: memory.current ~= 29M > child 1: memory.current ~= 21M > child 2: memory.current ~= 0 > > In reality, the actual memory usages can differ quite a bit from the > expected values. It uses an error tolerance of 10% with the values_close() > helper. > > Both the test_memcg_min and test_memcg_low sub-tests can fail > sporadically because the actual memory usage exceeds the 10% error > tolerance. Below are a sample of the usage data of the tests runs > that fail. > > Child Actual usage Expected usage %err > ----- ------------ -------------- ---- > 1 16990208 22020096 -12.9% > 1 17252352 22020096 -12.1% > 0 37699584 30408704 +10.7% > 1 14368768 22020096 -21.0% > 1 16871424 22020096 -13.2% > > The current 10% error tolerenace might be right at the time > test_memcontrol.c was first introduced in v4.18 kernel, but memory > reclaim have certainly evolved quite a bit since then which may result > in a bit more run-to-run variation than previously expected. > > Increase the error tolerance to 15% for child 0 and 20% for child 1 to > minimize the chance of this type of failure. The tolerance is bigger > for child 1 because an upswing in child 0 corresponds to a smaller > %err than a similar downswing in child 1 due to the way %err is used > in values_close(). > > Before this patch, a 100 test runs of test_memcontrol produced the > following results: > > 17 not ok 1 test_memcg_min > 22 not ok 2 test_memcg_low > > After applying this patch, there were no test failure for test_memcg_min > and test_memcg_low in 100 test runs. Ideally we want to calculate these values dynamically based on the machine size (number of cpus and total memory size). We can calculate the memcg error margin and scale memcg sizes if necessarily. It's the only way to make it pass both on a 2-CPU's vm and 512-CPU's physical server. Not a blocker for this patch, just an idea for the future. Thanks!