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 483ABC4332F for ; Fri, 22 Apr 2022 23:50:20 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B92046B0073; Fri, 22 Apr 2022 19:50:19 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id B40876B0074; Fri, 22 Apr 2022 19:50:19 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9E1D16B0075; Fri, 22 Apr 2022 19:50:19 -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 90C036B0073 for ; Fri, 22 Apr 2022 19:50:19 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay11.hostedemail.com (Postfix) with ESMTP id 63B1480D4B for ; Fri, 22 Apr 2022 23:50:19 +0000 (UTC) X-FDA: 79386161358.13.C96DC09 Received: from out1.migadu.com (out1.migadu.com [91.121.223.63]) by imf11.hostedemail.com (Postfix) with ESMTP id C1EDF40017 for ; Fri, 22 Apr 2022 23:50:16 +0000 (UTC) Date: Fri, 22 Apr 2022 16:50:12 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1650671417; 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=YMfzDL5JA0cUmzPiRnDBwSelMHWpmqS+/mHuZZauqFM=; b=a+wi3HYiqinXhmAX1F9VwZBpjFQJL0pEqfkuYWeOMEbit0scO0zBp35fOMYk8PD20VerZ5 lumIWn3vCbVEP5N/z551GXFlgE+D5hka3VN93XUFQK1IT3xwVd6YYdtf7IuZbb095kD4Mu j4o406/OQtOcmMxu4SB1znE57WD+Apk= 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 4/5] cgroup: Removing racy check in test_memcg_sock() Message-ID: References: <20220422155728.3055914-1-void@manifault.com> <20220422155728.3055914-5-void@manifault.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220422155728.3055914-5-void@manifault.com> X-Migadu-Flow: FLOW_OUT X-Migadu-Auth-User: linux.dev X-Rspamd-Queue-Id: C1EDF40017 X-Stat-Signature: 6ka44pow3qf1tca93wee8qucmfy8h995 X-Rspam-User: Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=linux.dev header.s=key1 header.b=a+wi3HYi; spf=pass (imf11.hostedemail.com: domain of roman.gushchin@linux.dev designates 91.121.223.63 as permitted sender) smtp.mailfrom=roman.gushchin@linux.dev; dmarc=pass (policy=none) header.from=linux.dev X-Rspamd-Server: rspam09 X-HE-Tag: 1650671416-739193 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:28AM -0700, David Vernet wrote: > test_memcg_sock() in the cgroup memcg tests, verifies expected memory > accounting for sockets. The test forks a process which functions as a TCP > server, and sends large buffers back and forth between itself (as the TCP > client) and the forked TCP server. While doing so, it verifies that > memory.current and memory.stat.sock look correct. > > There is currently a check in tcp_client() which asserts memory.current >= > memory.stat.sock. This check is racy, as between memory.current and > memory.stat.sock being queried, a packet could come in which causes > mem_cgroup_charge_skmem() to be invoked. This could cause memory.stat.sock > to exceed memory.current. Reversing the order of querying doesn't address > the problem either, as memory may be reclaimed between the two calls. But just curious, does it fix the flakiness (assuming there is no memory pressure)? > Instead, this patch just removes that assertion altogether, and instead > relies on the values_close() check that follows to validate the expected > accounting. Acked-by: Roman Gushchin