From patchwork Tue Aug 1 13:56:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Johannes Weiner X-Patchwork-Id: 13336732 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 06CF4C001E0 for ; Tue, 1 Aug 2023 13:56:37 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 61FC594001D; Tue, 1 Aug 2023 09:56:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5CFF2940010; Tue, 1 Aug 2023 09:56:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 4975C94001D; Tue, 1 Aug 2023 09:56:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 3AD30940010 for ; Tue, 1 Aug 2023 09:56:37 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 07E3BC0D19 for ; Tue, 1 Aug 2023 13:56:37 +0000 (UTC) X-FDA: 81075686034.13.1E2CF7A Received: from mail-qt1-f182.google.com (mail-qt1-f182.google.com [209.85.160.182]) by imf17.hostedemail.com (Postfix) with ESMTP id 3D5EC4000F for ; Tue, 1 Aug 2023 13:56:34 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=iLH7vqnb; spf=pass (imf17.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.182 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1690898194; 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:references:dkim-signature; bh=XJLGW04mxEToFfRDeoOpyp00hE8LNX9fFBjKrCRhwps=; b=7/PI7RnOm610ptuXyIPYYqeGCaMtOF8ncgQ669L0Sa6ccrWpNoj1BKMyfPxCo8ugRn18Wa TVfbfsxFoI0rmJwShhqAwPBoCGOFNtzo8x0YcdQ3ZIL5y+LyBv/J9k4ODbNwZ9vrHvEwyV 2gut2Rq6y668H7AAIEuI13yFXFxWVRA= ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690898194; a=rsa-sha256; cv=none; b=DkePQUfWruk/rEteS8js8AI/uDjfDiDW8zODP4axRzuYaPODm+0ZO82iHv11pHhPfCxkri BAquCl+oo6Gl4jdIeOaeC1MzTsFk0tfEFNiZ9J3yWA5sHpdyxbkzOc/2CiYhMl2Tiy/17f 4DZdLAN5gPe1Qb3s6nkvml4b5u0Z5lY= ARC-Authentication-Results: i=1; imf17.hostedemail.com; dkim=pass header.d=cmpxchg-org.20221208.gappssmtp.com header.s=20221208 header.b=iLH7vqnb; spf=pass (imf17.hostedemail.com: domain of hannes@cmpxchg.org designates 209.85.160.182 as permitted sender) smtp.mailfrom=hannes@cmpxchg.org; dmarc=pass (policy=none) header.from=cmpxchg.org Received: by mail-qt1-f182.google.com with SMTP id d75a77b69052e-403b36a4226so28633881cf.0 for ; Tue, 01 Aug 2023 06:56:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cmpxchg-org.20221208.gappssmtp.com; s=20221208; t=1690898193; x=1691502993; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=XJLGW04mxEToFfRDeoOpyp00hE8LNX9fFBjKrCRhwps=; b=iLH7vqnb28PIkYe34u+mDj70sMwzhlg2Nc9Lt2f4INh+KceFZ4zMmArs8alLU4u0W1 xuDos8oBmOj2eI8hOcKxNyjB9tlUl5gULORkj9AFCEfX0mZRPKbeVkBWvQtw3rU0aFZL qGVxwxzioM5kQNEUjBSr/VS4Yudj1ZSYn+Pk67O/2OGEHBnObl0Oxjqh5w56/qFguZeF 0P4o7c44YclUPTxHlqXaMpNGRbK83ZiiVTuS+udod4EI3YUzNvZi7AAMVqNq6u/dr4Mv NoUhcNOKuM2pesfsikO7xYyIiTwESwnALMqSuZQOqB6X+3xxzvPkTuuBoUokQu/Pu+Gu /KBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690898193; x=1691502993; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=XJLGW04mxEToFfRDeoOpyp00hE8LNX9fFBjKrCRhwps=; b=LdfYEfIeKJdllJ7Q7qYGK0pauW6oewBqt01tZXNB9Izmdlzr6NuVVD89bBEty9+VAw 17Len/ss8SPpiqpHsB/d3G1vxrHc72AhTHjsqqqt7SG19AgCPDy+stvknx1hX8+cVxdV zdNbrH7wC8vkXc7Bp19wE4hEDdR6Qbb7VgMUrpvbpugrG18BgwmDMXeBN8Pr5YQhn1dC 5fj6iFHZjUkbkV2274atyKjrf4GntyILfUX+Dm2JLQDYDaJyAn8h3ja6Gilf7FXqW07s Us89xbBgy+O+1hLyv7821PpGtK4UsxFv9BoMzpuQn8TuhKTl7JPqP3cubo6Gw+3LxWYw dfHA== X-Gm-Message-State: ABy/qLYDM2QvqohIq313uU4hUb+quySQHZDvjuqZ+XA8VGfr8u3+5oMa WvlBy4Xh2HHidZ3QRaCNRjPO9g== X-Google-Smtp-Source: APBJJlHENlK+WateqGlF3CA9rHgN32+u2UbuYvusGApJRTWPvSgkpYMrWjdUy8Nk/EukrVLPAteZTQ== X-Received: by 2002:a05:622a:1a18:b0:402:4bf3:7f41 with SMTP id f24-20020a05622a1a1800b004024bf37f41mr12515923qtb.29.1690898193176; Tue, 01 Aug 2023 06:56:33 -0700 (PDT) Received: from localhost (2603-7000-0c01-2716-8f57-5681-ccd3-4a2e.res6.spectrum.com. [2603:7000:c01:2716:8f57:5681:ccd3:4a2e]) by smtp.gmail.com with ESMTPSA id c27-20020ac8009b000000b004054b435f8csm4446390qtg.65.2023.08.01.06.56.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 01 Aug 2023 06:56:32 -0700 (PDT) From: Johannes Weiner To: Andrew Morton Cc: Roman Gushchin , Michal Hocko , "Paul E. McKenney" , linux-kselftest@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] selftests: cgroup: fix test_kmem_basic false positives Date: Tue, 1 Aug 2023 09:56:32 -0400 Message-ID: <20230801135632.1768830-1-hannes@cmpxchg.org> X-Mailer: git-send-email 2.41.0 MIME-Version: 1.0 X-Rspamd-Queue-Id: 3D5EC4000F X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: swb4aecfykyy1ch6mjjfuxij54qnd16h X-HE-Tag: 1690898194-394516 X-HE-Meta: U2FsdGVkX1/XN7xyi/MNy2cbG05EaOgzFMCrzNWYb/edFoxU7RLh6cUxZbND8P6aFeMKiSU2G9ZT7t5kMzB2sproUiSmxCVOLU6zW4M862VOCKPiAun65kwcG5bpzXNZxDXZJc0s3Wof1HMHTi69XZBEWlkaoNH6kkjGSy8C2ummgh6v2am0gxXtogucgInMp09hILR+RN0vAOlZfAgyIhsghVeO1uKTdlw2es4gFTKnZF9wjWcs8KtEH1qAs1PcQK5vu2aGqArNmQdrPkZz4ijBlmaoBWrWlheu1RZDnQHawVxh+AYpi7UHmRg+0eEHzWxJk8dejzKCofvifURDIuWNLU3+Nr+zSkKsOvEjHziZOTO9AyDY9R0Lpx8tVGZdSLD6lyoCDB4RPFS4bBOmO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sHwzs= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000004, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: This test fails routinely in our prod testing environment, and I can reproduce it locally as well. The test allocates dcache inside a cgroup, then drops the memory limit and checks that usage drops correspondingly. The reason it fails is because dentries are freed with an RCU delay - a debugging sleep shows that usage drops as expected shortly after. Insert a 1s sleep after dropping the limit. This should be good enough, assuming that machines running those tests are otherwise not very busy. Signed-off-by: Johannes Weiner Acked-by: Paul E. McKenney --- tools/testing/selftests/cgroup/test_kmem.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/testing/selftests/cgroup/test_kmem.c b/tools/testing/selftests/cgroup/test_kmem.c index 258ddc565deb..1b2cec9d18a4 100644 --- a/tools/testing/selftests/cgroup/test_kmem.c +++ b/tools/testing/selftests/cgroup/test_kmem.c @@ -70,6 +70,10 @@ static int test_kmem_basic(const char *root) goto cleanup; cg_write(cg, "memory.high", "1M"); + + /* wait for RCU freeing */ + sleep(1); + slab1 = cg_read_key_long(cg, "memory.stat", "slab "); if (slab1 <= 0) goto cleanup;