Message ID | 20250404012435.656045-2-longman@redhat.com (mailing list archive) |
---|---|
State | New |
Headers | show
Return-Path: <owner-linux-mm@kvack.org> 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 7468CC3601B for <linux-mm@archiver.kernel.org>; Fri, 4 Apr 2025 01:25:12 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B02A06B0022; Thu, 3 Apr 2025 21:25:09 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 9F3046B0025; Thu, 3 Apr 2025 21:25:09 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 894C36B0023; Thu, 3 Apr 2025 21:25:09 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 64F776B0023 for <linux-mm@kvack.org>; Thu, 3 Apr 2025 21:25:09 -0400 (EDT) Received: from smtpin21.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id 5C45D161A55 for <linux-mm@kvack.org>; Fri, 4 Apr 2025 01:25:10 +0000 (UTC) X-FDA: 83294617980.21.F6C5CB4 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf16.hostedemail.com (Postfix) with ESMTP id 67A5518000F for <linux-mm@kvack.org>; Fri, 4 Apr 2025 01:25:08 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BpNAJutJ; spf=pass (imf16.hostedemail.com: domain of longman@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1743729908; 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-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=u40nOJ01a63ZVAi+7N9ee5JQSwTN52ClpcX6EeuMZm0=; b=yFsANXu7l6ZG9cGpZzgVmYLD56Hn2F+DaYImNtTOQvKf9ZcFGsXu/+S+NySEQeZbnPpOHU 3SpJf7cQgjuv3Q+Q2i93hlpz5HxITm3XYidB/eqj5P7Om//MzXjbpWcD5Omju0plPJ+PTu YPQ1F5r9hu0Ral91eKfie+oBcUoCDc4= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1743729908; a=rsa-sha256; cv=none; b=5xBzYJ3WfFxZh6AVCE+ydI4q453lPptKati2HviIGuzKxR8evUsUgq+1MAQWEqnBxnzQkh NPbcMDGYqHrzQ+AQiSTRvpunm0dfK4qZwFUe6v/TiUY4FL0ol2TqEzssImWZfg6lk/AOxn aA1zI01XR3RLUqSfl2i4K12f9JSZr0Q= ARC-Authentication-Results: i=1; imf16.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=BpNAJutJ; spf=pass (imf16.hostedemail.com: domain of longman@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=longman@redhat.com; dmarc=pass (policy=quarantine) header.from=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1743729907; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=u40nOJ01a63ZVAi+7N9ee5JQSwTN52ClpcX6EeuMZm0=; b=BpNAJutJ7tR6/x6DLV4fu4AfbBK4FTE4OGnuDRCIOCu+ysVgFqzWUIwBM5WbfTjMuZSIgE qE8KyX36HV+AsV9v4hF/az6ofwz1lfQywRmBRSR/t/ny9wMd5DuUWHSci/M0bI4l5NxG9i 2Kv1aFnYQr05+zCMDrfPFUb20woE8HI= Received: from mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-619-KHq0k6vyOk6VLwGfDTM-rQ-1; Thu, 03 Apr 2025 21:25:03 -0400 X-MC-Unique: KHq0k6vyOk6VLwGfDTM-rQ-1 X-Mimecast-MFC-AGG-ID: KHq0k6vyOk6VLwGfDTM-rQ_1743729901 Received: from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 06D8419560B3; Fri, 4 Apr 2025 01:25:01 +0000 (UTC) Received: from llong-thinkpadp16vgen1.westford.csb (unknown [10.22.89.4]) by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1FAE51828A9F; Fri, 4 Apr 2025 01:24:57 +0000 (UTC) From: Waiman Long <longman@redhat.com> To: Johannes Weiner <hannes@cmpxchg.org>, Michal Hocko <mhocko@kernel.org>, Roman Gushchin <roman.gushchin@linux.dev>, Shakeel Butt <shakeel.butt@linux.dev>, Muchun Song <muchun.song@linux.dev>, Andrew Morton <akpm@linux-foundation.org>, Tejun Heo <tj@kernel.org>, =?utf-8?q?Michal_Koutn=C3=BD?= <mkoutny@suse.com>, Shuah Khan <shuah@kernel.org> Cc: linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, Waiman Long <longman@redhat.com> Subject: [PATCH v2 2/2] selftests: memcg: Increase error tolerance of child memory.current check in test_memcg_protection() Date: Thu, 3 Apr 2025 21:24:35 -0400 Message-ID: <20250404012435.656045-2-longman@redhat.com> In-Reply-To: <20250404012435.656045-1-longman@redhat.com> References: <20250404012435.656045-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.93 X-Stat-Signature: mqwgpxoeocc8oniihhrwef5ok3jxmpxk X-Rspam-User: X-Rspamd-Queue-Id: 67A5518000F X-Rspamd-Server: rspam08 X-HE-Tag: 1743729908-336313 X-HE-Meta: U2FsdGVkX1+0j5Xx5mhdcjMf28HkdnsRTgQa3D7f1JxU9FIzv4YsCPmVCn97GgpHqkgerhucuEPnttwsi/IPTkRL7udvEbMBmtg712Th4I2IMb9lMj02Wl/lGMBBxQpDMfMxG3i1Vodvu35UV6GUviDCuSYkkghrV3F/fALz26JBMPDSBU0uYtMRml4ZUflLjvVECgcfKw6t3d5OAl55auuIuZMTSnkLSdL7oBDYoFckSraKMTrWbuMQVktPK2I0EqspAaZKxk2i7f0e7DYnwKxLa8kzrsNZotWLmHmLLDUaHmheuJ8Zm/wdnVJooa1vGH9jgUkZjVJG5a3j6M/0uuwu4PGA2e11EVxOv2vsEyEDyo/bf8NOUe6I2at87+mZ1QXpn24dOxjLSFoBJb2c//B6mMt4ijtlJqjhZZ+xo6a1vZ3jWP1RKv6uUtF0XhY74QAZPsQ/sCVymyc9n+H1jG3ScnS5Wiyk6g4954MNwh6TlGZ1HrqM/Klmo9X3plr0BE0DOUJidyi3gZ2nKVeA5R6gXREKbsh2mb5ECg9FzJmF3gioQ5K5R+S6MBe+bcq3ou79cXub8FR302E16Q9KleREUMMOfbJ0rplZ39J5mj2meSf5MVX6JTxEi8uozZyAVEy9nL9uWGV8Yx/Z93UuJQayvSKj1YXYzgHG0VZqGdI1CrUiL7BfESZjcbe8yH1movkchpZYexyApENNjHxjpg63w9d8rm9uDFrZJ+m06ee0FvOGS+EseeIn8StztNCbNOEilcYvOZJroDA+ThS+F53NqQNxa5MFRgrdBPW72gGEsQL9wzERSgY/5xCvmki3PrcWx79sT9FmIP7jQdGxmvc3YkF5yWFloeqenipMdvbnVdWIOSt04EcV/bGBNNC6yhFS1BTd8FMSvZDL1d//XbRxHt/fJjtT14xoz9eTgCBDKw8wWlpVcoTJ9pr+lwdzYLogPEdtvyiaTr05f8B UnyTqcCu R5eQKdhrFFg2uI9GD56KJSVEMhVLm1GMW/ruQbtIZnQ7NbxC+QCNt9yVpkt7EdtMf5u8hjCiENekJbtglXjmhmiF64iUN1RjdyAHkqwOTeQc3U2gwvQqASvYZHLiEtXbrwjctfejZc08IdEcQmRZ6yUhgcWkIUz3DfQkIIKxXpbkqj4hCIUUJfZdcCLcfiPBbu86NAxq7VbeN5+m0Y2S1CTZ5TX9EvSADVChNB9TwBrKWvVUIg3LHPytv9G6PWtNk1wf7Q8KRXkbcdmDCYVCHpTTi8I5155vLbSt2Lean9jVeEaWovwZJxfiaE8D+sFO3VC1yugGyQnBRucDuFBCxRZQqkTRC9TS6HHvcI7MdRr8r5nUYAXe6Trdlkiw4jMGVsiEE 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: <linux-mm.kvack.org> List-Subscribe: <mailto:majordomo@kvack.org> List-Unsubscribe: <mailto:majordomo@kvack.org> |
Series |
[v2,1/2] memcg: Don't generate low/min events if either low/min or elow/emin is 0
|
expand
|
diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index 16f5d74ae762..f442c0c3f5a7 100644 --- a/tools/testing/selftests/cgroup/test_memcontrol.c +++ b/tools/testing/selftests/cgroup/test_memcontrol.c @@ -495,10 +495,10 @@ static int test_memcg_protection(const char *root, bool min) for (i = 0; i < ARRAY_SIZE(children); i++) c[i] = cg_read_long(children[i], "memory.current"); - if (!values_close(c[0], MB(29), 10)) + if (!values_close(c[0], MB(29), 15)) goto cleanup; - if (!values_close(c[1], MB(21), 10)) + if (!values_close(c[1], MB(21), 20)) goto cleanup; if (c[3] != 0)
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: 19 not ok 3 test_memcg_min 13 not ok 4 test_memcg_low After applying this patch, there were no test failure for test_memcg_min and test_memcg_low in 100 test runs. Signed-off-by: Waiman Long <longman@redhat.com> --- tools/testing/selftests/cgroup/test_memcontrol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)