From patchwork Fri Aug 4 19:35:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Karpinski X-Patchwork-Id: 13342299 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 6BCE1C001DB for ; Fri, 4 Aug 2023 19:35:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A87D76B0071; Fri, 4 Aug 2023 15:35:58 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A38FE6B0072; Fri, 4 Aug 2023 15:35:58 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9004E6B0074; Fri, 4 Aug 2023 15:35:58 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id 8066C6B0071 for ; Fri, 4 Aug 2023 15:35:58 -0400 (EDT) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id 4FE58B3175 for ; Fri, 4 Aug 2023 19:35:58 +0000 (UTC) X-FDA: 81087427596.08.8CE4E78 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by imf21.hostedemail.com (Postfix) with ESMTP id 8CC321C001A for ; Fri, 4 Aug 2023 19:35:54 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EKepgm59; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of lkarpins@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=lkarpins@redhat.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1691177756; 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: references:dkim-signature; bh=/fEGLQTPa3ePRn0SUruCR/akdAF06PibGk+SoDw6oqs=; b=hUnekOiBozncQAYxqJjvh5JjlQQtGCholpPgsxPPwVbx14YG+dv121493q4a3oz9mGb6p5 4V1uhECE0J1XLW/D0+eS9eYLuyaC5A2mkIatq3Nj8Yk8UWaLn4TwNG/HyamUGsQGTsdNxh Ahvkc7NSfn+IZIog1n+BE7NBUSWTbsw= ARC-Authentication-Results: i=1; imf21.hostedemail.com; dkim=pass header.d=redhat.com header.s=mimecast20190719 header.b=EKepgm59; dmarc=pass (policy=none) header.from=redhat.com; spf=pass (imf21.hostedemail.com: domain of lkarpins@redhat.com designates 170.10.129.124 as permitted sender) smtp.mailfrom=lkarpins@redhat.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1691177756; a=rsa-sha256; cv=none; b=fd2ud5HMGe3cVqkLakzO1lOwqyn2zIb46O4Utqp6jLwaKwo3WcZpFKxhT9FrKrd9qwZR/Q p4Yj6Bj2UvXe7FbRG+wcSj5aiTLpH6jjxNUyD1qJ5oHEFV6EjGLnKQdCJJiBQcF/dv3tM1 5WwW4OIbgp8kOK5J/FC8V8GtMOKtv4g= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1691177753; 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; bh=/fEGLQTPa3ePRn0SUruCR/akdAF06PibGk+SoDw6oqs=; b=EKepgm59iEW0B4OmUB2n2dIYEg80eS9pWxANbLzawBzMWgFpg6+l4s5Ruko2L5Ly5/KabE KasgEN0ynKNy8fxLQDBeP7t3iisxryDBy6YvUmnFIr1vCi6Kz3ob9aVvxsa7cmmIMULOFc NmCw4HnM4J3dxnEklTAxl+oVQ9xWBlM= 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-147-kdslNLLhO2egTOepnaBa1w-1; Fri, 04 Aug 2023 15:35:51 -0400 X-MC-Unique: kdslNLLhO2egTOepnaBa1w-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-7659c6caeaeso319685985a.3 for ; Fri, 04 Aug 2023 12:35:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691177751; x=1691782551; h=user-agent:content-disposition:mime-version:message-id:subject:cc :to:from:date:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=/fEGLQTPa3ePRn0SUruCR/akdAF06PibGk+SoDw6oqs=; b=QhDsWbDWLk03MOlXbjv7p+7C865X0npQC/c1MCUmd27Wd+qUqST6CMC9/BX5DWB4aB rHdGx9erkinGhQYFjfWJZ5zAWjq0KHini/sWkXXSiCibS6N7KZQHPeKQ2csD0mavoVp7 JbC/OmP6KxKO7f3ue70bKUOCA3Be29IPTMAlaBKtvF40r91CDN6A1blqW12dlteGNQWW wxqajI4Vf/ugxWag1IyZPYQ87tSAK8LpAMEAfoYbvlu2/s30xyrj3FLOc8ESNJ6whiEe TdlhBAcfIyuguzoKoe2BR2OCgCwRF1FizHXkqtYtltw5iArdHLIdffq2gPI+eFCMojvy gxxA== X-Gm-Message-State: AOJu0Yw7HkAHSqSZb/3Jup7n9DAzhwI59eAryukOlYIptD1yig091RJa Eiv21Ft0YOSuLWAfbNi25hcB7VIk20Iqf77XhRqmhpY7uo9OcOgNSNKKXDXy0/azI/SzbiEn6+U oAXn6OyB2c4U= X-Received: by 2002:a05:620a:4456:b0:76c:b476:f712 with SMTP id w22-20020a05620a445600b0076cb476f712mr3876348qkp.51.1691177751277; Fri, 04 Aug 2023 12:35:51 -0700 (PDT) X-Google-Smtp-Source: AGHT+IF+9eMVqPJLY6YIUSKa4NNv1paAfI3JX7M2BAluopih9iKnho0rRGuzu78ZOQHGnUECV5Khzw== X-Received: by 2002:a05:620a:4456:b0:76c:b476:f712 with SMTP id w22-20020a05620a445600b0076cb476f712mr3876330qkp.51.1691177751036; Fri, 04 Aug 2023 12:35:51 -0700 (PDT) Received: from fedora ([174.89.37.244]) by smtp.gmail.com with ESMTPSA id 4-20020a05620a070400b0076745f352adsm847974qkc.59.2023.08.04.12.35.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Aug 2023 12:35:45 -0700 (PDT) Date: Fri, 4 Aug 2023 15:35:29 -0400 From: Lucas Karpinski To: Andrew Morton , Johannes Weiner , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Tejun Heo , Zefan Li , Shuah Khan Cc: Muchun Song , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v3] selftests: cgroup: fix test_kmem_basic less than error Message-ID: <7d6gcuyzdjcice6qbphrmpmv5skr5jtglg375unnjxqhstvhxc@qkn6dw6bao6v> MIME-Version: 1.0 User-Agent: NeoMutt/20230517 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Disposition: inline X-Rspam-User: X-Stat-Signature: 3iu5mgcc8hg4cpwxi3uqieeqk6zq11jh X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: 8CC321C001A X-HE-Tag: 1691177754-332948 X-HE-Meta: U2FsdGVkX1/w+G5CXKMVyPlsdRV9aWjj9+OHxhxL2UwNEvQVioIPX0sF2C3S9BxkAqk5gbPya9gTHcGd+9bi+rqeNKoeJdC6ndX4YZu9DnhBnyZBYRaQqXlPSs8nvTHn12w3VVo9ltrg1HQqWIXgo+Ofs7+v2pguKCi4XD8LviK2MIPCBg8dcEI9nArcHPKJTquLrvTniTnqVz7nEAVkxEJ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uUpy6XzL2A9tXddZm+AUY/e8p3DfD3abQ9QGtxpqDzc06/2hPW8IjFkWBFj8YzkqjgzBypxU5Ro1N3mM2j833ZI7qh+eXHH5XIT1jb0mSVaZFqpSahpBtrNrktDt+u9A+UaWPaw6tw7jHXehwGX5gF6lFMvICehK+Bt5kQzJsblsTS0Dl5AKY6RxhL4Smuxs5O3k= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000894, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: test_kmem_basic creates 100,000 negative dentries, with each one mapping to a slab object. After memory.high is set, these are reclaimed through the shrink_slab function call which reclaims all 100,000 entries. The test passes the majority of the time because when slab1 or current is calculated, it is often above 0, however, 0 is also an acceptable value. Signed-off-by: Lucas Karpinski --- In the previous patch, I missed a change to the variable 'current' even after some testing as the issue was so sporadic. Current takes the slab size into account and can also face the same issue where it fails since the reported value is 0, which is an acceptable value. Drop: b4abfc19 in mm-unstable V2: https://lore.kernel.org/all/ix6vzgjqay2x7bskle7pypoint4nj66fwq7odvd5hektatvp2l@kukoifnfj3dr/ tools/testing/selftests/cgroup/test_kmem.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c index 1b2cec9d18a4..ed2e50bb1e76 100644 --- a/tools/testing/selftests/cgroup/test_kmem.c +++ b/tools/testing/selftests/cgroup/test_kmem.c @@ -75,11 +75,11 @@ static int test_kmem_basic(const char *root) sleep(1); slab1 = cg_read_key_long(cg, "memory.stat", "slab "); - if (slab1 <= 0) + if (slab1 < 0) goto cleanup; current = cg_read_long(cg, "memory.current"); - if (current <= 0) + if (current < 0) goto cleanup; if (slab1 < slab0 / 2 && current < slab0 / 2)