Re: Low TCP throughput due to vmpressure with swap enabled
From: Shakeel Butt <hidden>
Date: 2022-12-05 19:33:39
Also in:
cgroups, linux-mm, lkml
On Mon, Nov 28, 2022 at 01:07:25PM -0500, Johannes Weiner wrote:
[...]
quoted
With the patch applied I'm capped at ~120MB/s, which is a symptom of a clamped window. I can't find any sockets with memcg->socket_pressure = 1, but at the same time I only see the following rcv_ssthresh assigned to sockets:Hm, I don't see how socket accounting would alter the network behavior other than through socket_pressure=1.
I think what is happening is that the tcp stack is calling tcp_under_memory_pressure() and making decisions without going through the memcg charge codepath which set or reset memcg->socket_pressure. Most probably the socket is clamped due to memcg->socket_pressure and then the kernel never tried to grow its buffers because memcg->socket_pressure is still set and thus never tried the memcg charge codepath which would have reset memcg->socket_pressure. (Maybe) That is my guess but network experts CCed can correct me. Anyways, I don't think the pressure mechanism which relies on successful charging will work. I am brainstorming towards memory.high based network throttling. Basically use penalty_jiffies (or something similar) to set memcg->socket_pressure. However I want this to be opt-in as we do have applications which prefer to be killed than be throttled. So, still working on the fine details how this can be done without introducing a rigid API.