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: 131361 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp112854vqr; Fri, 4 Aug 2023 14:35:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHYjGzAg6/xmGbTW7j2NCUFQiN6QhjtkOVXgGdumViF4mhy/rOj4ZGg5VBWoCQtbLlESuDr X-Received: by 2002:a17:906:5193:b0:994:4095:3abf with SMTP id y19-20020a170906519300b0099440953abfmr2509119ejk.14.1691184908602; Fri, 04 Aug 2023 14:35:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1691184908; cv=none; d=google.com; s=arc-20160816; b=hkTvLrgi7AgxMidjyClyDL7Pc5fsirrgONkrTjKABvZDTeyTI5ZyaAD/UeMAo+IXMu 5+zexY+Gr4IPwzGmTTIBWHeB7l4lpjMaCfOt1RHx4jw+IGS+ZZARWWKKorabBtnLJRGE 7UJHYOlMXnoMFG9Bjx60IErkEEBXfIr80aIe8x7TaZmfMN0a817FpPA5Rqn7g+m406Zn tCJ226RYu8CDIzyShZMpIxkh+pBjgj+zxxTylQzCBieHmzEJf5vR2otIwdFJbDSrLyLA BHenDtoUlJKGyOuE4IwP/0bgSlOv3MXZzcNhdZVVdSSd06ctWqtRRMTr3yCIrl4drJAL RCag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:content-disposition:mime-version :message-id:subject:cc:to:from:date:dkim-signature; bh=/fEGLQTPa3ePRn0SUruCR/akdAF06PibGk+SoDw6oqs=; fh=9XXgHxlTCvaNzyqA2lfG2ipwZ+M9BkQwDdXD6g0UlK0=; b=EZIN4eXufMjsdWd47JKqo6lnfhYZgjXCEfqyu7m3mlBKfXXcNe3rXMxwIJuumU7x6v nBnoAS5iplpiKAUg2wuCRSWajoj/sH+4xAiSPkBdRTy9WZ6D9LGHAAfEN24rotgzP4nC tGlHyIRRHF3dzGXiCptmx+ZfLj2/yk1rMK2FxPZPNiKpWh/CVATibjCqBofk0iIhAZzi hV4Ol+ctlpgvWbHR+25Y+l3Lhi9+hm46nAD9pui/b/ExDoHxMQsyzbBVfsGYKbyLSoWh 9JiKf0S57GCfvpCh7LQC4wCmndCDPeNXfuZizsMCA30vOGrXOxtbqgg3lVPCRVaod6Nn jyAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EKepgm59; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fx12-20020a170906b74c00b00988a4a7abc8si2155706ejb.75.2023.08.04.14.34.44; Fri, 04 Aug 2023 14:35:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=EKepgm59; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229932AbjHDTgn (ORCPT + 99 others); Fri, 4 Aug 2023 15:36:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55708 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229514AbjHDTgk (ORCPT ); Fri, 4 Aug 2023 15:36:40 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08CDB1BF for ; Fri, 4 Aug 2023 12:35:53 -0700 (PDT) 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-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-695-n8H82iVCPP2op9dPsI0c9Q-1; Fri, 04 Aug 2023 15:35:51 -0400 X-MC-Unique: n8H82iVCPP2op9dPsI0c9Q-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-7659c6caeaeso319685885a.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=TrLRAqqvnjlL8aNcUnQe4NExsG3/+qbpREvUPEEhsGYdaCN018HPc9k6DWRiEbBL8J ScY8y6GMuIP80Wqs9w9fCX5Tm1m7fKB8J8GPjhNUIvHwPpsHdT5ubkUi9IsGhgso+k7p Q9y3N9oW+FtWCGoFrTznRqWk/KcsxVRsAbCi/vOdNkFBW8Xtw3hVZapkdkhq6tCL7/TE 6IlRpeeh2Hp+s+jYnFQqVAlU93yFGf15xvm1dkWAuQnpLX+ToH3gFz8NdaC/2bR2TRXU 4si7mGOKb0BEn6eoq/WCMa//ApaLXljSAgMtoa43pl9FMBTLG0N3tFXYp9LxDJFL6D9l AdLg== X-Gm-Message-State: AOJu0Yzq38NMZb6VAL7HCdEsk0OC4a2reEs5aJinX3lkCGcCd91EsNex cQ54wDImyijUMDU+5ZX6rcL4IXRLFvVDYG3EQs0fRl6VtOREkK01vYw4n8bfvTg9twECPCMHFNc r/CTNRTEkQAEnl4cGCzDdNqY7 X-Received: by 2002:a05:620a:4456:b0:76c:b476:f712 with SMTP id w22-20020a05620a445600b0076cb476f712mr3876342qkp.51.1691177751274; Fri, 04 Aug 2023 12:35:51 -0700 (PDT) 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 Content-Disposition: inline User-Agent: NeoMutt/20230517 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773335906490016984 X-GMAIL-MSGID: 1773335906490016984 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)