Received: by 2002:a05:7412:bb8d:b0:d7:7d3a:4fe2 with SMTP id js13csp78921rdb; Mon, 14 Aug 2023 10:00:53 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHAHiIXEXJRXmRaSJq5HPL/d0jZ37z3ArGnKox24QJ3NW32pCfrho+JIoRJuE9+4QnsTYKR X-Received: by 2002:a17:906:7489:b0:993:e752:1a71 with SMTP id e9-20020a170906748900b00993e7521a71mr8505442ejl.9.1692032453013; Mon, 14 Aug 2023 10:00:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1692032452; cv=none; d=google.com; s=arc-20160816; b=RO6IBih2S3A3urALcAfo8p8WmU7uY+HA7ScythyI90HtYhRrCAIlg6IN6oysYXXFhk M4Ab9RlUzM1a2oYqUVbXsyQ0X0OHUWJuMG1IJXQcMge9OnyZSEGTjhzY9Wr55SLjcZXk CiAMQ11ovqNPR6AnXnNCqFab++gP7OHEQUT0CJq/KRIUdwuptkoub2gTndBaz0n9l6R3 Gdt3M5/qO/Xe0Q8jhvVhWUngj543GixObb4b1lAM5Al7dlh0KwaAEaMxZruXmn6X/HlR PQwVJ76t29vmsmRiDGVMLOrzrUKE9fHh62BXgvcQP3/qlb3DyDaesDpuHYM0ZlveY8pN aINw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=7qH/OU93DvHxo0hLIYaxXR0nJoX5oGDzCEQsY4s9O1c=; fh=/ean6TD/FpSHVQxkA3eUx7ghT4tlSJ04FQJpZeoqMjY=; b=zNmWshJjYg/S8v1hBRtMLqpZIezxNFKxoRtgmgj0m/3PTjnl4euTmANjpKbPJP7COb xTqjSCS1FX17o0vyS3OX4Z3DL00DQ/NF4uTwlsowuwp1mcwy+oCId2X+v0JFzd+VaDpT rG8R6eUUebuYkBLOY27S8opP6U1QNj0w5AiKVLfEgmUNMBLl2w+e+QvN2ESvZZwLh5kG UBJTOhbKvc2kRoeK5sXBvcmGhUSxZwQ41ev/Lexwrd/w3VmNHzzs93e1Xv8tlqE62UH+ Bap8ULFDuQ2dgQ17HKqrGZy9vzIa58KXPXW17QGEioXy5/375aJ5z++3cOhu5QEnc+ZY PmLQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=A4GFCdph; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a1709061d4b00b009882f2a8aabsi7899029ejh.551.2023.08.14.10.00.09; Mon, 14 Aug 2023 10:00:52 -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=A4GFCdph; 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 S230155AbjHNP6e (ORCPT + 99 others); Mon, 14 Aug 2023 11:58:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46516 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229674AbjHNP6N (ORCPT ); Mon, 14 Aug 2023 11:58:13 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EB5D109 for ; Mon, 14 Aug 2023 08:57:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692028652; 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: in-reply-to:in-reply-to:references:references; bh=7qH/OU93DvHxo0hLIYaxXR0nJoX5oGDzCEQsY4s9O1c=; b=A4GFCdphoNmiW7VBWxTZmhLZp2rXPB1LhchwHvY59q+Vdr62Z46lBuXhrpsLgWTFFaQWsT NyorszjeYBrs33U1uTMCW/1ZyOA4CqGPfoOo+PsgtrJCz4YmmvYMR33pNp6Xty3N6M6Vkx h2AATDaxKpCW7aEyf6SdNDzxQ6M0Qrw= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-326-cIGcbDCOPvucqnm-xMiFYQ-1; Mon, 14 Aug 2023 11:57:31 -0400 X-MC-Unique: cIGcbDCOPvucqnm-xMiFYQ-1 Received: by mail-qv1-f72.google.com with SMTP id 6a1803df08f44-64714cf9438so24351646d6.1 for ; Mon, 14 Aug 2023 08:57:31 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1692028651; x=1692633451; h=user-agent:in-reply-to:content-disposition:mime-version:references :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=7qH/OU93DvHxo0hLIYaxXR0nJoX5oGDzCEQsY4s9O1c=; b=Pu2WLYBNcFT7PAJdHxy5EsStYNVvT2X5ORFhGA5NmUJGbQ3bKer53tPNnbFbd5E454 TgKJYzWdB4OnpDsuuHqptuRRO94KdskHKtcWNRIBYYdl4K6aGJdjoSFWZ2jDcq2ZFCeI syOIR3tEq/rzjcyJlyE/rmDHyw0f/FQwNS41YvzcxcjHGixg+dTnYW3Qy65CHK+HOeSW 5A/xqOg4+m7Ac3+Kny5UDH/zD7Vl4KaoyK7Ri6y+pCSKE/JGapqzWLiZT2T6LI7qIYqC dmXfdaK7zX8o3+YWhi8btW4rFzJKT+ENM5EtJXk9DKwHaHZ52qO2OvPPdrTrV9ZZEdvR y1/A== X-Gm-Message-State: AOJu0Yx+BjUaidp+uj/RrOjzPgi1z5cRa+zF9SGYzvPqVKfZRmNcw9NV rmCTzBxJ356cFe6id3Xa4xC8NDdUo3BzcVOkzRKsKNGUzyuM3EdZRcxqjq1AAiwWNNM3tA95prO bvYewcoeXE4YyTJpDLSb4+VrZaWZGbRLdwxBDrg== X-Received: by 2002:a0c:8e45:0:b0:63c:fb61:a201 with SMTP id w5-20020a0c8e45000000b0063cfb61a201mr9439839qvb.35.1692028650889; Mon, 14 Aug 2023 08:57:30 -0700 (PDT) X-Received: by 2002:a0c:8e45:0:b0:63c:fb61:a201 with SMTP id w5-20020a0c8e45000000b0063cfb61a201mr9439829qvb.35.1692028650657; Mon, 14 Aug 2023 08:57:30 -0700 (PDT) Received: from fedora ([174.89.37.104]) by smtp.gmail.com with ESMTPSA id d11-20020a05620a166b00b00767d00d10e9sm3078589qko.58.2023.08.14.08.56.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Aug 2023 08:56:18 -0700 (PDT) Date: Mon, 14 Aug 2023 11:55:45 -0400 From: Lucas Karpinski To: Johannes Weiner Cc: Andrew Morton , Michal Hocko , Roman Gushchin , Shakeel Butt , Muchun Song , Tejun Heo , Zefan Li , Shuah Khan , cgroups@vger.kernel.org, linux-mm@kvack.org, linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] selftests: cgroup: fix test_kmem_memcg_deletion false positives Message-ID: References: <20230804163716.GA337691@cmpxchg.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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_BLOCKED,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL, SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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 Fri, Aug 04, 2023 at 02:59:28PM -0400, Lucas Karpinski wrote: > On Fri, Aug 04, 2023 at 12:37:16PM -0400, Johannes Weiner wrote: > > On Fri, Aug 04, 2023 at 11:37:33AM -0400, Lucas Karpinski wrote: > > > The test allocates dcache inside a cgroup, then destroys the cgroups and > > > then checks the sanity of numbers on the parent level. 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 completing the cgroup creation/deletions. This > > > should be good enough, assuming that machines running those tests are > > > otherwise not very busy. This commit is directly inspired by Johannes > > > over at the link below. > > > > > > Link: https://lore.kernel.org/all/20230801135632.1768830-1-hannes@cmpxchg.org/ > > > > > > Signed-off-by: Lucas Karpinski > > > > Maybe I'm missing something, but there isn't a limit set anywhere that > > would cause the dentries to be reclaimed and freed, no? When the > > subgroups are deleted, the objects are just moved to the parent. The > > counters inside the parent (which are hierarchical) shouldn't change. > > > > So this seems to be a different scenario than test_kmem_basic. If the > > test is failing for you, I can't quite see why. > > > You're right, the parent inherited the counters and it should behave > the same whether I'm directly removing the child or if I was moving it > under another cgroup. I do see the behaviour you described on my > x86_64 setup, but the wrong behaviour on my aarch64 dev. platform. I'll > take a closer look, but just wanted to leave an example here of what I > see. > > Example of slab size pre/post sleep: > slab_pre = 18164688, slab_post = 3360000 > > Thanks, > Lucas Looked into the failures and I do have a proposed solution, just want some feedback first. With how the kernel entry in memory.stat is updated, it takes into account all charged / uncharged pages, it looks like it makes more sense to use that single entry rather than `slab + anon + file + kernel_stack + pagetables + percpu + sock' as it would cover all utilization. Thanks, Lucas