[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YmM/NCX9FwUY/GvB@carbon>
Date: Fri, 22 Apr 2022 16:50:12 -0700
From: Roman Gushchin <roman.gushchin@...ux.dev>
To: David Vernet <void@...ifault.com>
Cc: akpm@...ux-foundation.org, tj@...nel.org,
linux-kernel@...r.kernel.org, linux-mm@...ck.org,
cgroups@...r.kernel.org, hannes@...xchg.org, mhocko@...nel.org,
shakeelb@...gle.com, kernel-team@...com
Subject: Re: [PATCH 4/5] cgroup: Removing racy check in test_memcg_sock()
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 <roman.gushchin@...ux.dev>
Powered by blists - more mailing lists