public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
To: Shakeel Butt <shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
Cc: Wei Wang <weiwan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	Eric Dumazet <edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
	netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	"David S . Miller"
	<davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
	cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org,
	Roman Gushchin
	<roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org>
Subject: Re: [PATCH net-next] net-memcg: pass in gfp_t mask to mem_cgroup_charge_skmem()
Date: Wed, 12 Oct 2022 17:38:25 -0700	[thread overview]
Message-ID: <20221012173825.45d6fbf2@kernel.org> (raw)
In-Reply-To: <CALvZod5pKzcxWsLnjUwE9fUb=1S9MDLOHF950miF8x8CWtK5Bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>

On Wed, 12 Oct 2022 17:17:38 -0700 Shakeel Butt wrote:
> Did the revert of this patch fix the issue you are seeing? The reason
> I am asking is because this patch should not change the behavior.
> Actually someone else reported the similar issue for UDP RX at [1] and
> they tested the revert as well. The revert did not fix the issue for
> them.
> 
> Wei has a better explanation at [2] why this patch is not the cause
> for these issues.

We're talking TCP here, to be clear. I haven't tested a revert, yet (not
that easy to test with a real workload) but I'm relatively confident the
change did introduce an "unforced" call, specifically this bit:

@@ -2728,10 +2728,12 @@ int __sk_mem_raise_allocated(struct sock *sk, int size, int amt, int kind)
 {
 	struct proto *prot = sk->sk_prot;
 	long allocated = sk_memory_allocated_add(sk, amt);
+	bool memcg_charge = mem_cgroup_sockets_enabled && sk->sk_memcg;
 	bool charged = true;
 
-	if (mem_cgroup_sockets_enabled && sk->sk_memcg &&
-	    !(charged = mem_cgroup_charge_skmem(sk->sk_memcg, amt)))
+	if (memcg_charge &&
+	    !(charged = mem_cgroup_charge_skmem(sk->sk_memcg, amt,
+						gfp_memcg_charge())))

where gfp_memcg_charge() is GFP_NOWAIT in softirq.

The above gets called from (inverted stack):
 tcp_data_queue()
 tcp_try_rmem_schedule(sk, skb, skb->truesize)
 tcp_try_rmem_schedule()
 sk_rmem_schedule()
 __sk_mem_schedule()
 __sk_mem_raise_allocated()

Is my confidence unjustified? :)

  parent reply	other threads:[~2022-10-13  0:38 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-17 19:40 [PATCH net-next] net-memcg: pass in gfp_t mask to mem_cgroup_charge_skmem() Wei Wang
     [not found] ` <20210817194003.2102381-1-weiwan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2021-08-18 10:50   ` patchwork-bot+netdevbpf-DgEjT+Ai2ygdnm+yROfE0A
2022-10-12 23:33   ` Jakub Kicinski
     [not found]     ` <20221012163300.795e7b86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2022-10-13  0:17       ` Shakeel Butt
     [not found]         ` <CALvZod5pKzcxWsLnjUwE9fUb=1S9MDLOHF950miF8x8CWtK5Bw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2022-10-13  0:38           ` Jakub Kicinski [this message]
     [not found]             ` <20221012173825.45d6fbf2-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2022-10-13  0:54               ` Shakeel Butt
     [not found]                 ` <20221013005431.wzjurocrdoozykl7-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>
2022-10-13  1:40                   ` Jakub Kicinski
     [not found]                     ` <20221012184050.5a7f3bde-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2022-10-13  3:16                       ` Jakub Kicinski
2022-10-13  3:34                         ` Wei Wang
2022-10-13  3:49                           ` Jakub Kicinski
     [not found]                             ` <20221012204941.3223d205-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2022-10-13  4:04                               ` Wei Wang
2022-10-13  4:18                                 ` Shakeel Butt
2022-10-13 21:49       ` Jakub Kicinski
     [not found]         ` <20221013144950.44b52f90-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2022-10-13 22:02           ` Eric Dumazet

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=20221012173825.45d6fbf2@kernel.org \
    --to=kuba-dgejt+ai2ygdnm+yrofe0a@public.gmane.org \
    --cc=cgroups-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
    --cc=edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=linux-mm-Bw31MaZKKs3YtjvyW6yDsg@public.gmane.org \
    --cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=roman.gushchin-fxUVXftIFDnyG1zEObXtfA@public.gmane.org \
    --cc=shakeelb-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
    --cc=weiwan-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.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