Message ID | 20250415210415.13414-3-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 35AC5C369BD for <linux-mm@archiver.kernel.org>; Tue, 15 Apr 2025 21:04:44 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 14D5A6B0198; Tue, 15 Apr 2025 17:04:42 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 0D5B46B0199; Tue, 15 Apr 2025 17:04:42 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id EB8EF6B019A; Tue, 15 Apr 2025 17:04:41 -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 BFC526B0199 for <linux-mm@kvack.org>; Tue, 15 Apr 2025 17:04:41 -0400 (EDT) Received: from smtpin25.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id E68AE1CEA85 for <linux-mm@kvack.org>; Tue, 15 Apr 2025 21:04:41 +0000 (UTC) X-FDA: 83337507162.25.63EE8CC Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf26.hostedemail.com (Postfix) with ESMTP id 16338140018 for <linux-mm@kvack.org>; Tue, 15 Apr 2025 21:04:39 +0000 (UTC) Authentication-Results: imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YJHG5oHM; spf=pass (imf26.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=1744751080; 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=G181R4Ce8Y0oezWUB5dkYUGLwtFvIKy14kWYL4Idox0=; b=l5eidy0VBXC6n2r4dZ8cVXd5LyIkarmWhU19COPGdzcVKtxrYXI4IoCAUUFZrcpJudiUeA d4RBcUprRyGflxIZHWeOGDNK08uawBGa3BOrgrqzuheNGAFRD0q/AHJS923dBYBqjvQHjU e7iH1yp2r//N9KvdQg6aoULyGq661hs= ARC-Authentication-Results: i=1; imf26.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=YJHG5oHM; spf=pass (imf26.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-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744751080; a=rsa-sha256; cv=none; b=4XtATnsQlXdZoGkXRrDK/GAmModm9gQcyO23e28HhltbKjMFTZZnhm0RsUuif0fmnZJabf mz1wdbkA6QCtyiZdYr67W10wI5qvvsWoR739eSMwisxr6bNquUZ3FyuYWz9aHpe2ZAnOOR TcCzJVaW1CKWCqhuR+UWHoosPgq3zB4= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1744751079; 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=G181R4Ce8Y0oezWUB5dkYUGLwtFvIKy14kWYL4Idox0=; b=YJHG5oHM9dNshL0Aac/D3aCXpaLItAWQb5hSwLVcVuBX4dipevXhrxf/KF8z0cfguEr71+ KMUNLgFXGRA/0NnannG3SNQg2+eqy+BfoUwZGkjLYDcOQvXUF2fexftg6EoPdOGoHXfr2G J/E73ecHkYBKAhvKVdZ/y/HvC34T6k0= Received: from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-527-ja4OLp0VOwmG-_HocO_yiA-1; Tue, 15 Apr 2025 17:04:35 -0400 X-MC-Unique: ja4OLp0VOwmG-_HocO_yiA-1 X-Mimecast-MFC-AGG-ID: ja4OLp0VOwmG-_HocO_yiA_1744751074 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F213C1808985; Tue, 15 Apr 2025 21:04:33 +0000 (UTC) Received: from llong-thinkpadp16vgen1.westford.csb (unknown [10.22.64.119]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 02B6C19792DC; Tue, 15 Apr 2025 21:04:30 +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 v7 2/2] selftests: memcg: Increase error tolerance of child memory.current check in test_memcg_protection() Date: Tue, 15 Apr 2025 17:04:15 -0400 Message-ID: <20250415210415.13414-3-longman@redhat.com> In-Reply-To: <20250415210415.13414-1-longman@redhat.com> References: <20250415210415.13414-1-longman@redhat.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 X-Rspam-User: X-Rspamd-Server: rspam09 X-Rspamd-Queue-Id: 16338140018 X-Stat-Signature: q6bxkwskkp6xbi6t1949o1fb5w36d83b X-HE-Tag: 1744751079-383392 X-HE-Meta: U2FsdGVkX1/XOISkxSfJc41YeMPITfKX48m+q1v40RvN1799wKOIB+hIU+kmWyJj4CqYSuRpJEXZ844vfOOpCePHBgMcHuGJ18o6Pnsy5aiJqhA/ELas5kmPLRLU2rsNRDDU5rfzOQioK22TaJZIf/Tw4S6ZJK5XfxM/pmB8vQJx7+9be3svzImvzcyvCfP+Fn6W5pnHy4H47XxhjQTGvq1SpQ5dFFQQrb8yUMvMyypjkzI6NneMfuQVm2pqJ14XmaaYL5AafPlSCe3z+YQ7/bRdZs7xAfvbt3KZLKLQd9P0OFuPRMS/ukaKDDFHQCd6s38uw4+fZBuF94aoBYthcI8Mp68Du+Eh4wSuFz00TwIh38FrYEpoFVjUhaS5+sgf7bSV8LBai49UVzRb6DHXL1FI3Wy+bBJal8fO+eA77j/9/HvRz5a+IHONLuaKz9smnAXD+XN+0Q34Qnjdc2VuS8RymfBPbTFQGmfM1qibyHXOgtVvyDMZTaIveAWAoQ8sUW/oDvj0gON9i5M+B1bSuWwCPXcu3T4RvVbYtXhY/QhxS3P5PuELwDQgJLKnphfAO7SPguiWbuuvayrqkcAhRcAgSwKYm8zBQLXjKKwRkak7AK7qLfW7hqSoXQo7hWEb/6k2rQSK3bAoDco/XMGmJwvvKuRFu5kGdwaHSJaVEaIeUzEFRyUx3061OUwvnrtPmOiZRQ+WUhuKh3qJDEdZT0ujogBwmUZFC1mNqU4WSov0n2fuWeH/RTOUtYT5jZS27YgqpKPYQzu4bnY6qCnE1GMaHkOr76DpMmh/yfhE5r562i9Nes8HUVAEJLNFwUQ+qSz6swKv+WeTiYF4+QGSkAT+hwy4lQRYThBySaW63LoQubDC5rE05yDaatVKGQnfUTggpwZEpeK3/RzbPzP2hlGpVCDJimbtgk0i23wOa5cd92ADumONeaWc1SXjRwFG9FslyeP1tdtp5km8NLk L00tyra3 WXwTyjNeyGmyIJ+iz5tz1w8IGcJn3mlw5M8/bDuGbjDVo/m6pwUDn/TWLfnr4asbWuvEgdcoxXKm64ysnPjSttStjdrDFGS9u3doe4/6vA2bipEa4n15b1vAE1LNsBPPDxmCWwIIQ8zsb+GwpZs4LV+hgjEtGlh8OltgC56K21qkueQsb09+r8pSKMSoW0LFG9N4o+Slx3ucVbNJDPO9vit+fdRgJvgjU17JStdby2O6p0IMmYABdqruxcrEE7YT4viJoT/NUKYg6uqO6t+YLdjEtkoI1P3E9GqRyrvckHzbGpiFLGJUDuHsqXxePnkrcStj4Z8bCXAUJFGAJe6JztMXigSKlfGBsm76SILAyzlzeVTfKpanJv9uuQ0A4dQrRfOrU X-Bogosity: Ham, tests=bogofilter, spamicity=0.000001, 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 |
memcg: Fix test_memcg_min/low test failures
|
expand
|
diff --git a/tools/testing/selftests/cgroup/test_memcontrol.c b/tools/testing/selftests/cgroup/test_memcontrol.c index 5a5dcbe57b56..2ef07b8fa718 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: 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. However, these tests may still fail once in a while if the memory usage goes beyond the newly extended range. Signed-off-by: Waiman Long <longman@redhat.com> --- tools/testing/selftests/cgroup/test_memcontrol.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)