From: Paolo Abeni <pabeni@redhat.com>
To: Jason Xing <kerneljasonxing@gmail.com>,
simon.horman@corigine.com, willemdebruijn.kernel@gmail.com,
davem@davemloft.net, dsahern@kernel.org, edumazet@google.com,
kuba@kernel.org
Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
bpf@vger.kernel.org, Jason Xing <kernelxing@tencent.com>
Subject: Re: [PATCH v3 net-next] udp: introduce __sk_mem_schedule() usage
Date: Tue, 07 Mar 2023 15:55:20 +0100 [thread overview]
Message-ID: <2ad119bd1f24f408921b16eb0ebdf67935d1d880.camel@redhat.com> (raw)
In-Reply-To: <20230307015620.18301-1-kerneljasonxing@gmail.com>
On Tue, 2023-03-07 at 09:56 +0800, Jason Xing wrote:
> From: Jason Xing <kernelxing@tencent.com>
>
> Keep the accounting schema consistent across different protocols
> with __sk_mem_schedule(). Besides, it adjusts a little bit on how
> to calculate forward allocated memory compared to before. After
> applied this patch, we could avoid receive path scheduling extra
> amount of memory.
>
> Link: https://lore.kernel.org/lkml/20230221110344.82818-1-kerneljasonxing@gmail.com/
> Signed-off-by: Jason Xing <kernelxing@tencent.com>
> ---
> v3:
> 1) get rid of inline suggested by Simon Horman
>
> v2:
> 1) change the title and body message
> 2) use __sk_mem_schedule() instead suggested by Paolo Abeni
> ---
> net/ipv4/udp.c | 31 ++++++++++++++++++-------------
> 1 file changed, 18 insertions(+), 13 deletions(-)
>
> diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
> index c605d171eb2d..60473781933c 100644
> --- a/net/ipv4/udp.c
> +++ b/net/ipv4/udp.c
> @@ -1531,10 +1531,23 @@ static void busylock_release(spinlock_t *busy)
> spin_unlock(busy);
> }
>
> +static int udp_rmem_schedule(struct sock *sk, int size)
> +{
> + int delta;
> +
> + delta = size - sk->sk_forward_alloc;
> + if (delta > 0 && !__sk_mem_schedule(sk, delta, SK_MEM_RECV))
> + return -ENOBUFS;
> +
> + sk->sk_forward_alloc -= size;
I think it's better if you maintain the above statement outside of this
helper: it's a bit confusing that rmem_schedule() actually consumes fwd
memory.
Side note
Cheers,
Paolo
next prev parent reply other threads:[~2023-03-07 15:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-07 1:56 Jason Xing
2023-03-07 14:55 ` Paolo Abeni [this message]
2023-03-08 2:12 ` Jason Xing
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=2ad119bd1f24f408921b16eb0ebdf67935d1d880.camel@redhat.com \
--to=pabeni@redhat.com \
--cc=bpf@vger.kernel.org \
--cc=davem@davemloft.net \
--cc=dsahern@kernel.org \
--cc=edumazet@google.com \
--cc=kerneljasonxing@gmail.com \
--cc=kernelxing@tencent.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=simon.horman@corigine.com \
--cc=willemdebruijn.kernel@gmail.com \
/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
all inboxes | Powered by JetHome®