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 0ABE9C369AB for ; Sun, 13 Apr 2025 03:15:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 74C2A680051; Sat, 12 Apr 2025 23:15:07 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 65117680041; Sat, 12 Apr 2025 23:15:07 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4F386680051; Sat, 12 Apr 2025 23:15:07 -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 2DB19680041 for ; Sat, 12 Apr 2025 23:15:07 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 58A4EB1B58 for ; Sun, 13 Apr 2025 03:15:08 +0000 (UTC) X-FDA: 83327554296.08.7D78D8B Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf04.hostedemail.com (Postfix) with ESMTP id 0A6824000B for ; Sun, 13 Apr 2025 03:15:05 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WMUAkrpw; spf=pass (imf04.hostedemail.com: domain of llong@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=llong@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=1744514106; 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:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=BZ2AIgXN2yGPN7Sxu2wl5jNXWejeTiuda2OwXuQQY0I=; b=ywoGxkTIjmVcefenx1tWUqsIQvJVnABN7Mtncq+xmKoKtV9uO4pwYazdgaSfsYLx5CY6NE hG9zzDP1xVbzi3hBmLgq+KMfZL4LkkCtG4UXPAPw99FIdvAz5QPGnAaeMacGFSFTR46f3Z FnY/MA4fyqSPUsmuTUG5XQsuJYWD3iY= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1744514106; a=rsa-sha256; cv=none; b=oZO6yRoIBYyjfPWCezpjwnX2GpxKKXdndtGlYC/yffZf5Io2Q7mabtZynrxiom0EdNMk+s WBkKKJUcZtgByi9k8kcsSJa4g4aAHXJ1tYjMTdKjK370B6me5xniQ+PjUzdx6vVFziJO1N j/pSl4FAN91ueyyLvEpdz3+DjaHKBaA= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=WMUAkrpw; spf=pass (imf04.hostedemail.com: domain of llong@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=llong@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=1744514105; 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: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=BZ2AIgXN2yGPN7Sxu2wl5jNXWejeTiuda2OwXuQQY0I=; b=WMUAkrpwkpKSbdggmy+HjO0VBj17OE1AcLqqaDOTl4l2yQ8cHfhUX3mtI3g2MCS6sWvX6c X89j+PrcOOug+6G9i1hfEh/8DXCPFrnWEpSH8/d/PFwFqxiRxnWQv/1gqBC2b03Lq3vmdx WwYe1bbz4g5Y2c6qGCXuFWyvT00RfDk= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-135-KZOwCapgOhu1ocNftQytZw-1; Sat, 12 Apr 2025 23:15:03 -0400 X-MC-Unique: KZOwCapgOhu1ocNftQytZw-1 X-Mimecast-MFC-AGG-ID: KZOwCapgOhu1ocNftQytZw_1744514103 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7c5f3b94827so573442285a.0 for ; Sat, 12 Apr 2025 20:15:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1744514103; x=1745118903; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:user-agent:mime-version:date:message-id:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BZ2AIgXN2yGPN7Sxu2wl5jNXWejeTiuda2OwXuQQY0I=; b=BEXVFt5EMslwLi9/dDQsXlwD0p6c1noGaVFkqoY9sOyg/YOxFe8RKmAgjy30HWFt2u G3+O9JTzx+b+yQeeG54CGgZ74kKakkEqYqWl48sVSi9UcCTO06zDPHQGMpu6S2eeUWhf n6AlcF9CI08NJY5vAGKz7uw9WKaXbnNR+Gal3toxbRTyLB7/iPwo86PoM12kpA/e9He4 KvkDaPa/8ZEMC4dDPfBj0UHU0JUPN6VdNbjxrBBJ0Agwz3ugGDJZOZEYCGrQ2bBJ5jpD MD6C6f/vNzgt7b2le8D4d66G8xzq38Bk7JXyoiVEVI+cgcO1V7mt2O58/TloaBMa2Ljw 5r3g== X-Forwarded-Encrypted: i=1; AJvYcCUF2ovvv1BpUaBAANYA0LaoFjVT4Ih8Vcaa+k5/u3FvcRk96EETznCnpm9Da9ikIorfvjqQVhMbHw==@kvack.org X-Gm-Message-State: AOJu0Yw3HD5CA1sY91xeGciHbfCBNaSDaX6o2ZRvEwxe/GeXc5QFZp9M 7AbApBNnPSSFak+90wEyrpEOnVZq7NkMOfwzj0wDt4mw+a8Go+J0ix2HSSM14N0vP3XqDzdRvN6 DtijieehvJ8M5/xAWb6ZZw5KQxWd3s0gObNpbz/XW+97RpUo8 X-Gm-Gg: ASbGncsjuWYV7xcH9CSs98D2NJvMhodB+WHRleN6RVy00bQ07PnPrX6GZmJG+2vMTrk cFQcSOcwFbczp5M6US35CPotRnvH+QW3EWct9Lhfv6E8duzD8fQP/P12oD3YxCpygcQnqT2SOWV lpqr5pZ8X+IbVqzPhF2bX8l1kG4RsyFK2vqQYuKON/dvBee6GfbnOooRB1MuU6ctE+g69dGslHu +tU6RL8N0jl+7+/GjC9+SNizgqdt+KodAj8b/QoeIic3N0JxITqAYrVjXpePEWNA4W/QIVOUqbv AEAx+67y1btq3DacMCCwnas2o9SJAzCX+68WjG+BK1u7NPM2YvbjPg== X-Received: by 2002:a05:620a:f0c:b0:7c5:50ab:de07 with SMTP id af79cd13be357-7c7af0d4854mr1206659085a.21.1744514103032; Sat, 12 Apr 2025 20:15:03 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHEgZdkNpb8M2sLPV1/LXGt3hDMHfPduIrP6ippNwIGXHw9JexKgaMOOMOlNxn4UhxXHLuaKg== X-Received: by 2002:a05:620a:f0c:b0:7c5:50ab:de07 with SMTP id af79cd13be357-7c7af0d4854mr1206655885a.21.1744514102577; Sat, 12 Apr 2025 20:15:02 -0700 (PDT) Received: from [172.20.3.175] (syn-108-176-116-062.biz.spectrum.com. [108.176.116.62]) by smtp.gmail.com with ESMTPSA id af79cd13be357-7c7a8a0f1fasm495773985a.112.2025.04.12.20.15.01 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 12 Apr 2025 20:15:01 -0700 (PDT) From: Waiman Long X-Google-Original-From: Waiman Long Message-ID: Date: Sat, 12 Apr 2025 23:15:00 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 2/2] selftests: memcg: Increase error tolerance of child memory.current check in test_memcg_protection() To: Roman Gushchin Cc: Johannes Weiner , Michal Hocko , Shakeel Butt , Muchun Song , Andrew Morton , Tejun Heo , =?UTF-8?Q?Michal_Koutn=C3=BD?= , Shuah Khan , linux-kernel@vger.kernel.org, cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org References: <20250406024010.1177927-1-longman@redhat.com> <20250406024010.1177927-3-longman@redhat.com> In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: 5SvI-frSEs4DLX9CbKrxE0qDDtDViRiMc2zlSRx_Izc_1744514103 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Stat-Signature: gkdebombo1n8r8rcqojfsungiacffg4h X-Rspam-User: X-Rspamd-Queue-Id: 0A6824000B X-Rspamd-Server: rspam08 X-HE-Tag: 1744514105-517143 X-HE-Meta: U2FsdGVkX1+qbAnZUIIV4Vib57mh16iNR65UdyzNHv3oKtMlcyobCME+qWp5vOdfVqxQIOutgpWz+FODPitogZo7Q5bTvdlL2Eus3rusw7x7/YPIXFFEiER8eHLrjqsIk07ACqlVVwnySG/LQsv0kaW7sETGjCqGxIU4Vj/iiBz2pcE+dHdezdcYej5LAFCGfBxSQ0Y9gCHAIyqhhkVUe8c5tqS838syFyFbptcLdLZ8TRfCeinBQeydjq97YFNYlNfoa3WnQnxP8hW4l1bHOl6dOSyH7IlDWjoTk1ZNrf9opUV/mY2RZU5Xhk0WwDOBNFO12c6ZLKpkIiX0z1evlHffYUgvntbl6XouhOUrM4wfXwHGJjESKpEppPqFaLMEPvwTxLJQ/OvsqdHI4nJApLod7QqguLAZhkY6K2iK7ffyksjkaTtpoYVwSMqYC/nD8aQ5uXdznmrF5xjqlmOVVcsFeoDv1KjSLCriYZrhImRWeSoNbOoRmonn4AWiiV+pttI+oqqR+pzI9nQC7lKTmlgJDnAM5Rfv81FZN6vSYLlV3cci9m0WlT5+6DRTvfdZLVdkBvyGUKQU7hUfPIJxJXFmvu7dEm02iSTNDjZLXOI6maWtX0PPN83OW6IjjPSZGHWsf9jUWMverAMCaLvBX4IZfMi7VFmYu5FpaIT76IZ+F4YhLqDuAmFSwrEJFxxuoiNyMK59hfQVhgJjmLfnawK0x8LdjPI++s/R59Dp5yvHkbKHC2LIUwwOyNBXHY4Vrn0XKQo6jUawWjUxSQkLlKYBx4o/YEvvXWKZD7EcHYPRgVIoxW/RV8Ew5w4i/1s/0AU2UeWDBdFYmFTMp2PiT8xmhav4NeZRtqZOdUzJt/czo0UK0T26tN89dHRq7V0vnCQx2eUnvP8VhNqYFvSwlwzYMd+Z28ymDNz2/0irGBme0VJM25/AI5JggQNCMCkFIDf75y154Er8RxCxxdy cjNDxZLW PYlQKiW3WcWynjkYyqQdscQMqBWePfjwn1xh6Qhwdkp8hWa5e09dQWuhAQIHQGJQTk51vqZJZz6gTLdTBHcqHV9pdliYtgMpiLguFkIiblV7Cj/b1yUO6OWDaGi81uNzbpdR7tzfp6py7CKiZW2ROd2l6FOSnkJKeQunVjbUr4pBctmsguONAhk9SSTcY2lZLvmh0gMGYDSdX3tRumJZ5ZeMgw1/EQCFaITMzW7XsAGRoEMHUyeKLA6lsWvK5kljqmNFfYUOBH8V+lJLHn4FMO6ydwO1DTj5x67v/KvswbAmz4HVqQDeyVxZ19WoGFzcdPV2yIGOqTK2+CnN91wFOZEwU+odcA4IeyQyTF1DJblu3d6mue5JmmgAXkjK8RH9jKB+JHFtnOFUY9hf3McgkAUrQSz4vueoRhcvL6WYZQwDlaSD7cQklqAHkgw== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000010, 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 4/8/25 6:22 PM, Roman Gushchin wrote: > 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 for the suggestion. As I said in a previous mail, the way the test works is by waiting until the the memory.current of the parent is close to 50M, then it checks the memory.current's of its children to see how much usage each of them have. I am not sure if nr of CPUs or total memory size is really a factor here. We will probably need to run some experiments to find out. Anyway, it will be a future patch if they are really a factor here. Cheers, Longman > > Thanks! >