From mboxrd@z Thu Jan 1 00:00:00 1970 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 24D8FC433EF for ; Fri, 22 Apr 2022 23:56:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id A51DA6B0073; Fri, 22 Apr 2022 19:56:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id A01196B0074; Fri, 22 Apr 2022 19:56:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 8EF9B6B0075; Fri, 22 Apr 2022 19:56:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (relay.hostedemail.com [64.99.140.25]) by kanga.kvack.org (Postfix) with ESMTP id 7F7276B0073 for ; Fri, 22 Apr 2022 19:56:22 -0400 (EDT) Received: from smtpin31.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 4768960439 for ; Fri, 22 Apr 2022 23:56:22 +0000 (UTC) X-FDA: 79386176604.31.C57734A Received: from out0.migadu.com (out0.migadu.com [94.23.1.103]) by imf30.hostedemail.com (Postfix) with ESMTP id CDECD8001A for ; Fri, 22 Apr 2022 23:56:17 +0000 (UTC) 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 Authentication-Results: imf30.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=v5MGwbB6; spf=pass (imf30.hostedemail.com: domain of roman.gushchin@linux.dev designates 94.23.1.103 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Rspam-User: X-Rspamd-Server: rspam05 X-Rspamd-Queue-Id: CDECD8001A X-Stat-Signature: qwib4g5x43ksh3j3uuxep7uh8t5fq6dc X-HE-Tag: 1650671777-698898 X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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!