From mboxrd@z Thu Jan 1 00:00:00 1970 From: Roman Gushchin Subject: Re: [PATCH 4/5] cgroup: Removing racy check in test_memcg_sock() Date: Fri, 22 Apr 2022 16:50:12 -0700 Message-ID: References: <20220422155728.3055914-1-void@manifault.com> <20220422155728.3055914-5-void@manifault.com> Mime-Version: 1.0 Return-path: 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= Content-Disposition: inline In-Reply-To: <20220422155728.3055914-5-void-gq6j2QGBifHby3iVrkZq2A@public.gmane.org> List-ID: Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: David Vernet Cc: akpm-de/tnXTf+JLsfHDXvbKv3WD2FQJk+8+b@public.gmane.org, tj-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org, cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, hannes-druUgvl0LCNAfugRpC6u6w@public.gmane.org, mhocko-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org, kernel-team-b10kYP2dOMg@public.gmane.org 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