From: Paolo Abeni <pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Eric Dumazet <eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
"David S. Miller" <davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org>,
James Morris <jmorris-gx6/JNMH7DfYtjvyW6yDsg@public.gmane.org>,
Trond Myklebust
<trond.myklebust-7I+n7zu2hftEKMMhf/gKZA@public.gmane.org>,
Alexander Duyck <aduyck-nYU0QVwCCFFWk0Htik3J/w@public.gmane.org>,
Daniel Borkmann <daniel-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org>,
Eric Dumazet <edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org>,
Tom Herbert <tom-BjP2VixgY4xUbtYUoyoikg@public.gmane.org>,
Hannes Frederic Sowa
<hannes-tFNcAqjVMyqKXQKiL6tip0B+6BGkLq7r@public.gmane.org>,
Edward Cree <ecree-s/n/eUQHGBpZroRs9YW3xA@public.gmane.org>,
linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH net-next v5 2/3] udp: implement memory accounting helpers
Date: Fri, 21 Oct 2016 13:43:41 +0200 [thread overview]
Message-ID: <1477050221.4606.6.camel@redhat.com> (raw)
In-Reply-To: <1476997834.7065.35.camel-XN9IlZ5yJG9HTL0Zs8A6p+yfmBU6pStAUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
On Thu, 2016-10-20 at 14:10 -0700, Eric Dumazet wrote:
> On Thu, 2016-10-20 at 22:31 +0200, Paolo Abeni wrote:
>
> > +
> > +int __udp_enqueue_schedule_skb(struct sock *sk, struct sk_buff *skb)
> > +{
> > + struct sk_buff_head *list = &sk->sk_receive_queue;
> > + int rmem, delta, amt, err = -ENOMEM;
> > + int size = skb->truesize;
> > +
> > + /* try to avoid the costly atomic add/sub pair when the receive
> > + * queue is full; always allow at least a packet
> > + */
> > + rmem = atomic_read(&sk->sk_rmem_alloc);
> > + if (rmem && (rmem + size > sk->sk_rcvbuf))
> > + goto drop;
> > +
> > + /* we drop only if the receive buf is full and the receive
> > + * queue contains some other skb
> > + */
> > + rmem = atomic_add_return(size, &sk->sk_rmem_alloc);
> > + if ((rmem > sk->sk_rcvbuf) && (rmem > size))
> > + goto uncharge_drop;
> > +
> > + skb_orphan(skb);
>
> Minor point :
>
> UDP should already have orphaned skbs ? (it uses skb_steal_sock())
You are right, the skb_orphan() call is redundant.
I'll send the v6 soon.
Thank you,
Paolo
--
To unsubscribe from this list: send the line "unsubscribe linux-nfs" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2016-10-21 11:43 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-20 20:31 [PATCH net-next v5 0/3] udp: refactor memory accounting Paolo Abeni
2016-10-20 20:31 ` [PATCH net-next v5 1/3] net/socket: factor out helpers for memory and queue manipulation Paolo Abeni
[not found] ` <cover.1476979679.git.pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-20 20:31 ` [PATCH net-next v5 2/3] udp: implement memory accounting helpers Paolo Abeni
[not found] ` <d932905c2581df9415449216eceeed1566290e3e.1476979679.git.pabeni-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2016-10-20 21:10 ` Eric Dumazet
[not found] ` <1476997834.7065.35.camel-XN9IlZ5yJG9HTL0Zs8A6p+yfmBU6pStAUsxypvmhUTTZJqsBc5GL+g@public.gmane.org>
2016-10-21 11:43 ` Paolo Abeni [this message]
2016-10-20 20:31 ` [PATCH net-next v5 3/3] udp: use it's own memory accounting schema Paolo Abeni
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=1477050221.4606.6.camel@redhat.com \
--to=pabeni-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
--cc=aduyck-nYU0QVwCCFFWk0Htik3J/w@public.gmane.org \
--cc=daniel-FeC+5ew28dpmcu3hnIyYJQ@public.gmane.org \
--cc=davem-fT/PcQaiUtIeIZ0/mPfg9Q@public.gmane.org \
--cc=ecree-s/n/eUQHGBpZroRs9YW3xA@public.gmane.org \
--cc=edumazet-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=eric.dumazet-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=hannes-tFNcAqjVMyqKXQKiL6tip0B+6BGkLq7r@public.gmane.org \
--cc=jmorris-gx6/JNMH7DfYtjvyW6yDsg@public.gmane.org \
--cc=linux-nfs-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=netdev-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=tom-BjP2VixgY4xUbtYUoyoikg@public.gmane.org \
--cc=trond.myklebust-7I+n7zu2hftEKMMhf/gKZA@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;
as well as URLs for NNTP newsgroup(s).