Received: by 2002:a05:6358:c692:b0:131:369:b2a3 with SMTP id fe18csp5984865rwb; Tue, 1 Aug 2023 10:30:51 -0700 (PDT) X-Google-Smtp-Source: APBJJlEdEJR65gmYdQNC6xBb1L/nEsnFPt9GC8v64c3rutc4t7B5rTP6alc5fb4eoK6e21YFX8hw X-Received: by 2002:a17:902:d2d1:b0:1bb:a55d:c6e7 with SMTP id n17-20020a170902d2d100b001bba55dc6e7mr15711774plc.55.1690911050779; Tue, 01 Aug 2023 10:30:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690911050; cv=none; d=google.com; s=arc-20160816; b=ReGsItadZO7whHv80hpR/c63doIPbMqx7drxp1bUJFGm8eUz2Tomq0blCQGIDNx8xB pBc5zdHXF9zWjgyHSxB01cBnIurHLYRMNFWM7dyjMz3tSrHpku7CHEh6vSF4itva6Ldq 55GtMhC9jAB8xu+MilxUHXfrzfuu1BAlTbHlKf+i/3+gLGQWKUEcCZjj1SH9hufAEKyh 64sdaWiY7iTRJawuwwvj72zOokt0kgI+mCapPBlN67HxQGZIgfcOpUCIxNl1z7Y7mIwH FOJEh+xtjlPC96ZDlo0CMDbesjNo9sLFy+Y3RjN+WCAyz0/UqJ3eTNoD9AtVoObt6kWz T2iw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:reply-to:message-id:subject:cc:to:from:date :dkim-signature; bh=WrcV6MyApF+vEXcUHuvQQkFuIACrK/PXc+uZ3r/kAiE=; fh=wWFUppXJENUVjGU5wc2Q++OmfptNzSiXtDl3kJ5AFBg=; b=gV4iae8TgNIOXxyNi1crt3v0jq65R6H9gHk+i5mUGbmAjLswYr2paBqfd4OQrvhaQV +LRfv1SaxB5Gze3DzQ4YSXrcSD7CqxgTQ2hg+aT4QhIMFycNE8+Umtk4mzW1wiXgqc99 MlkuQ1NcszSref7ObNXxLFrkVz8+7dqHeHYomZHO9Acs/YARAd3OAw7VtJfVTFb6+Sod j1SPn6BVypGDrpanSoi6BRhwniQlbYlkcam+MPAHu0mMG/Si0/Nd8y02QH8H5EjpcZUF 5Fsk1fYTr2dwhxv34IVtphz62BXfIzEi44hQtuNzIyfNWcAMqSBnh/IJqQlCoQPblyci T+0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=sstKmFBZ; 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=kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p4-20020a170902e74400b001b3d27ca12fsi4716660plf.207.2023.08.01.10.30.37; Tue, 01 Aug 2023 10:30:50 -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=@kernel.org header.s=k20201202 header.b=sstKmFBZ; 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=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231546AbjHAQjf (ORCPT + 99 others); Tue, 1 Aug 2023 12:39:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33222 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231596AbjHAQjb (ORCPT ); Tue, 1 Aug 2023 12:39:31 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 494F71FE5; Tue, 1 Aug 2023 09:39:30 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AF72761634; Tue, 1 Aug 2023 16:39:29 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1E39BC433C8; Tue, 1 Aug 2023 16:39:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1690907969; bh=peOB4gYXHi9+NQFqAEhqF+m0ecPnTZOeDb0Ne46VrRw=; h=Date:From:To:Cc:Subject:Reply-To:References:In-Reply-To:From; b=sstKmFBZwEw5V1wDtDA9C654z/Yt8zMozmuZHnlnXA+FW1Bfr3b4cWTxtjWqAVrMc DGtbYQFs7QmqFA7SlAYC0oArqV3nFtR4/0L4aN7rkwIo83nqld1sh7qIz7oBdHAR9i kWqZ66M4DSoRCfRCezLkRP5GmObapL0IaVJeb+prgzS2jCu0lsFrTMet1a6E59wBeS cJR78bviYofqm3PhnqJ4cHr6D4hD10UeWMTjXBosOQISY7JvEccmRLNse6D3BpiG6R 1/i/Z4AXElHXBtgQTqbP1oxoGtE0IF18eC5+32UBmpx4NFOPrmEUvG1h06FdZEjCb7 pG1VVo7qCb6Lw== Received: by paulmck-ThinkPad-P17-Gen-1.home (Postfix, from userid 1000) id A6A0BCE0908; Tue, 1 Aug 2023 09:39:28 -0700 (PDT) Date: Tue, 1 Aug 2023 09:39:28 -0700 From: "Paul E. McKenney" To: Johannes Weiner Cc: Andrew Morton , Roman Gushchin , Michal Hocko , linux-kselftest@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] selftests: cgroup: fix test_kmem_basic false positives Message-ID: Reply-To: paulmck@kernel.org References: <20230801135632.1768830-1-hannes@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230801135632.1768830-1-hannes@cmpxchg.org> 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_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 On Tue, Aug 01, 2023 at 09:56:32AM -0400, Johannes Weiner wrote: > 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 I am putting together something more formal, but this will certainly improve things, as Johannes says, assuming the system goes mostly idle during that one-second wait. So: Acked-by: Paul E. McKenney Yes, there are corner cases, such as the system having millions of RCU callbacks queued and being unable to invoke them all during that one-second interval. But that is a corner case, and that is exactly why I will be putting together something more formal. ;-) Thanx, Paul > --- > 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; > -- > 2.41.0 >