linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Shakeel Butt <shakeelb@google.com>
To: Johannes Weiner <hannes@cmpxchg.org>
Cc: Ivan Babrou <ivan@cloudflare.com>, Linux MM <linux-mm@kvack.org>,
	Linux Kernel Network Developers <netdev@vger.kernel.org>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	Michal Hocko <mhocko@kernel.org>,
	Roman Gushchin <roman.gushchin@linux.dev>,
	Muchun Song <songmuchun@bytedance.com>,
	Andrew Morton <akpm@linux-foundation.org>,
	Eric Dumazet <edumazet@google.com>,
	"David S. Miller" <davem@davemloft.net>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	David Ahern <dsahern@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	cgroups@vger.kernel.org, kernel-team <kernel-team@cloudflare.com>
Subject: Re: Low TCP throughput due to vmpressure with swap enabled
Date: Mon, 5 Dec 2022 19:28:14 +0000	[thread overview]
Message-ID: <20221205192814.diiwtktsrgxzccw2@google.com> (raw)
In-Reply-To: <Y4T43Tc54vlKjTN0@cmpxchg.org>

On Mon, Nov 28, 2022 at 01:07:25PM -0500, Johannes Weiner wrote:
> 
[...]
> > 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.


  reply	other threads:[~2022-12-05 19:33 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22  0:53 Low TCP throughput due to vmpressure with swap enabled Ivan Babrou
2022-11-22 18:01 ` Eric Dumazet
2022-11-22 18:11   ` Ivan Babrou
2022-11-22 18:23     ` Eric Dumazet
2022-11-22 18:59 ` Yu Zhao
2022-11-22 19:05   ` Ivan Babrou
2022-11-22 19:08     ` Yu Zhao
2022-11-22 19:46 ` Yu Zhao
2022-11-22 20:05   ` Yu Zhao
2022-11-23  0:44     ` Yu Zhao
2022-11-23 21:22       ` Johannes Weiner
2022-11-24  1:18         ` Yu Zhao
2022-11-24  1:29           ` Yu Zhao
2022-11-22 20:05 ` Johannes Weiner
2022-11-22 22:11   ` Ivan Babrou
2022-11-23  1:28     ` Ivan Babrou
2022-11-28 18:07       ` Johannes Weiner
2022-12-05 19:28         ` Shakeel Butt [this message]
2022-12-05 23:57         ` Ivan Babrou
2022-12-06  0:50           ` Ivan Babrou
2022-12-06 19:00             ` Johannes Weiner
2022-12-06 19:13               ` Eric Dumazet
2022-12-06 20:51                 ` Johannes Weiner
2022-12-06 23:10                   ` Shakeel Butt
2022-12-07 12:53                     ` Johannes Weiner
2022-12-08  0:31                       ` Shakeel Butt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20221205192814.diiwtktsrgxzccw2@google.com \
    --to=shakeelb@google.com \
    --cc=akpm@linux-foundation.org \
    --cc=cgroups@vger.kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=hannes@cmpxchg.org \
    --cc=ivan@cloudflare.com \
    --cc=kernel-team@cloudflare.com \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=mhocko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=roman.gushchin@linux.dev \
    --cc=songmuchun@bytedance.com \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).