Subject: Re: [RFC PATCH] accounting for socket backlog

From: Zhu Yi <[email-masked]>
Date: Fri, 26 Feb 2010 10:44:13 +0800

On Thu, 2010-02-25 at 16:31 +0800, David Miller wrote:
> > @@ -1372,8 +1372,13 @@ int udp_queue_rcv_skb(struct sock *sk, struct
> sk_buff *skb)
> >       bh_lock_sock(sk);
> >       if (!sock_owned_by_user(sk))
> >               rc = __udp_queue_rcv_skb(sk, skb);
> > -     else
> > +     else {
> > +             if (atomic_read(&sk->sk_backlog.len) >= sk->sk_rcvbuf)
> {
> > +                     bh_unlock_sock(sk);
> > +                     goto drop;
> > +             }
> >               sk_add_backlog(sk, skb);
> > +     }
> 
> We have to address this issue, of course, but I bet this method of
> handling it negatively impacts performance in normal cases.

Eric mentioned atomic is not required here. I don't think performance
will be impacted any more with the above if clause. Right?

> Right now we can queue up a lot and still get it to the application
> if it is slow getting scheduled onto a cpu, but if you put this
> limit here it could result in lots of drops. 

Or we can replace the sk->sk_rcvbuf limit with a backlog own limit. We
can queue "a lot", but not endless. We have to have a limit anyway.

Thanks,
-yi