Received: by 2002:a05:6a10:6d10:0:0:0:0 with SMTP id gq16csp1036655pxb; Fri, 22 Apr 2022 17:30:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw1+dbm2UoXlU647A1ubdakQwOanGnNI3iddHsaozlSKhOPqzNNPf0kpcGeyszNqboG2ShR X-Received: by 2002:a63:1c1d:0:b0:39d:9a7c:593b with SMTP id c29-20020a631c1d000000b0039d9a7c593bmr5939385pgc.157.1650673854964; Fri, 22 Apr 2022 17:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1650673854; cv=none; d=google.com; s=arc-20160816; b=OkUCmEvzQXPfQj5TY5p89/h4weTwWR+Cmm39BKU8EG0zp/SkAv+UEkRlwoe38kpplJ K3DTHJIRlqRa4HCCbuYHjDKcOXWLqg2HQU3Fh54U/G3uBLrNkEGrGpavNIrSvYbWXRwL 8QASm41lTUJ/WhProZj9C1+dGdGF6vpCnEf+/Ve75IpY2PTTHGM3DDyU/C94kn7uaT1K VVL2r6oTpYsfKlHU3BHYExYZc/qI5ELdnsiDMTpwiWh0fY/67iL7aeD8eVrs6OZk5lGd Lw7BuzgZUqssj6xIaTWTqM5UXuhiq20W1vxiOHrG0t1B+FfyX5wVFWRv4oOZyMqZF+a6 0uDg== 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:message-id:subject:cc:to:from:dkim-signature:date; bh=+EaQSEVslaLuejAKqVFqZ9iCKFR405OvDd1jGIm3QWY=; b=QIdzn8J3EfPszwz81IFP+dOkx1adD/d3AAxvGKRTBFsu+EQxQRbynHUlz7FVONdcud Pbo+NEDmfCZjG9ed0PX+qoK5FlNe7hUnwQUdiQs8MflyC6OfZmYmoiToT90TJ13vrWnK YI+C+CyUr+zTppvvB3sOQTyKSEfUYy30Dwksz63Z3CZndpsaswtwolugzRjiVjl7z3F8 z0plAcs/pUgYVY6oESw7gt2IQou93ywzEd5mr2z1rm6ISttozl/zU5pfxyQ/3x10RdNZ se78Z9TrYF78tDLAUbF4A7jWZHl8L45xBvEA0Sni8Ghc/dDSIhMf8nV8+NnCZV0yCqoR u3JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=v5MGwbB6; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id 137-20020a63048f000000b003aa7a7ec4aesi8775046pge.760.2022.04.22.17.30.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Apr 2022 17:30:54 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=v5MGwbB6; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 42F9B1D5193; Fri, 22 Apr 2022 16:57:47 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231150AbiDVX7U (ORCPT + 99 others); Fri, 22 Apr 2022 19:59:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230060AbiDVX7R (ORCPT ); Fri, 22 Apr 2022 19:59:17 -0400 Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB0251AFF52; Fri, 22 Apr 2022 16:56:21 -0700 (PDT) Date: Fri, 22 Apr 2022 16:56:14 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1650671780; 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=+EaQSEVslaLuejAKqVFqZ9iCKFR405OvDd1jGIm3QWY=; b=v5MGwbB6eilouV9kuZMZyAE6+dLSBhKbVeaZ8F/6IViG8ajAxiF9ycz9BrGwqr4PehJJzi P+XdDJ6vFBGpWd2jzo2fNy6RCUvTT1QUJMmHjzWoSmvKLW/AeewWt+FwV95+eCQgCI98lY xW6F8hjtauFm0NCmWFgLIOXxX0xLQBM= X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Roman Gushchin To: David Vernet Cc: akpm@linux-foundation.org, tj@kernel.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org, cgroups@vger.kernel.org, hannes@cmpxchg.org, mhocko@kernel.org, shakeelb@google.com, kernel-team@fb.com Subject: Re: [PATCH 5/5] cgroup: Fix racy check in alloc_pagecache_max_30M() helper function Message-ID: References: <20220422155728.3055914-1-void@manifault.com> <20220422155728.3055914-6-void@manifault.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220422155728.3055914-6-void@manifault.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE autolearn=no 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, Apr 22, 2022 at 08:57:29AM -0700, David Vernet wrote: > alloc_pagecache_max_30M() in the cgroup memcg tests performs a 50MB > pagecache allocation, which it expects to be capped at 30MB due to the > calling process having a memory.high setting of 30MB. After the allocation, > the function contains a check that verifies that MB(29) < memory.current <= > MB(30). This check can actually fail non-deterministically. > > The testcases that use this function are test_memcg_high() and > test_memcg_max(), which set memory.min and memory.max to 30MB respectively > for the cgroup under test. The allocation can slightly exceed this number > in both cases, and for memory.max, the process performing the allocation > will not have the OOM killer invoked as it's performing a pagecache > allocation. This patchset therefore updates the above check to instead use > the verify_close() helper function. > > Signed-off-by: David Vernet Acked-by: Roman Gushchin Thanks, David!