From: Soheil Hassas Yeganeh <soheil@google.com>
To: Eric Dumazet <edumazet@google.com>
Cc: "David S . Miller" <davem@davemloft.net>,
netdev <netdev@vger.kernel.org>, Alexei Starovoitov <ast@fb.com>,
Marcelo Ricardo Leitner <marcelo.leitner@gmail.com>,
Eric Dumazet <eric.dumazet@gmail.com>
Subject: Re: [PATCH v2 net-next 6/7] net: do not block BH while processing socket backlog
Date: Fri, 29 Apr 2016 09:37:00 -0400 [thread overview]
Message-ID: <CACSApvbh0y9v2yHNDfajmdD5HN9rdR3hN5_BgHdjAihc+A8Nmg@mail.gmail.com> (raw)
In-Reply-To: <1461899449-8096-7-git-send-email-edumazet@google.com>
On Thu, Apr 28, 2016 at 11:10 PM, Eric Dumazet <edumazet@google.com> wrote:
> Socket backlog processing is a major latency source.
>
> With current TCP socket sk_rcvbuf limits, I have sampled __release_sock()
> holding cpu for more than 5 ms, and packets being dropped by the NIC
> once ring buffer is filled.
>
> All users are now ready to be called from process context,
> we can unblock BH and let interrupts be serviced faster.
>
> cond_resched_softirq() could be removed, as it has no more user.
>
> Signed-off-by: Eric Dumazet <edumazet@google.com>
Acked-by: Soheil Hassas Yeganeh <soheil@google.com>
> ---
> net/core/sock.c | 22 ++++++++--------------
> 1 file changed, 8 insertions(+), 14 deletions(-)
>
> diff --git a/net/core/sock.c b/net/core/sock.c
> index e16a5db853c6..70744dbb6c3f 100644
> --- a/net/core/sock.c
> +++ b/net/core/sock.c
> @@ -2019,33 +2019,27 @@ static void __release_sock(struct sock *sk)
> __releases(&sk->sk_lock.slock)
> __acquires(&sk->sk_lock.slock)
> {
> - struct sk_buff *skb = sk->sk_backlog.head;
> + struct sk_buff *skb, *next;
>
> - do {
> + while ((skb = sk->sk_backlog.head) != NULL) {
> sk->sk_backlog.head = sk->sk_backlog.tail = NULL;
> - bh_unlock_sock(sk);
>
> - do {
> - struct sk_buff *next = skb->next;
> + spin_unlock_bh(&sk->sk_lock.slock);
>
> + do {
> + next = skb->next;
> prefetch(next);
> WARN_ON_ONCE(skb_dst_is_noref(skb));
> skb->next = NULL;
> sk_backlog_rcv(sk, skb);
>
> - /*
> - * We are in process context here with softirqs
> - * disabled, use cond_resched_softirq() to preempt.
> - * This is safe to do because we've taken the backlog
> - * queue private:
> - */
> - cond_resched_softirq();
> + cond_resched();
>
> skb = next;
> } while (skb != NULL);
>
> - bh_lock_sock(sk);
> - } while ((skb = sk->sk_backlog.head) != NULL);
> + spin_lock_bh(&sk->sk_lock.slock);
> + }
>
> /*
> * Doing the zeroing here guarantee we can not loop forever
> --
> 2.8.0.rc3.226.g39d4020
>
This is great! very nice patch.
next prev parent reply other threads:[~2016-04-29 13:37 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-29 3:10 [PATCH v2 net-next 0/7] net: make TCP preemptible Eric Dumazet
2016-04-29 3:10 ` [PATCH v2 net-next 1/7] tcp: do not assume TCP code is non preemptible Eric Dumazet
2016-04-29 13:18 ` Soheil Hassas Yeganeh
2016-04-29 14:37 ` Eric Dumazet
2016-04-29 14:41 ` Soheil Hassas Yeganeh
2016-04-29 3:10 ` [PATCH v2 net-next 2/7] tcp: do not block bh during prequeue processing Eric Dumazet
2016-04-29 13:20 ` Soheil Hassas Yeganeh
2016-04-29 3:10 ` [PATCH v2 net-next 3/7] dccp: do not assume DCCP code is non preemptible Eric Dumazet
2016-04-29 13:21 ` Soheil Hassas Yeganeh
2016-04-29 3:10 ` [PATCH v2 net-next 4/7] udp: prepare for non BH masking at backlog processing Eric Dumazet
2016-04-29 13:23 ` Soheil Hassas Yeganeh
2016-04-29 3:10 ` [PATCH v2 net-next 5/7] sctp: prepare for socket backlog behavior change Eric Dumazet
2016-04-29 3:10 ` [PATCH v2 net-next 6/7] net: do not block BH while processing socket backlog Eric Dumazet
2016-04-29 13:37 ` Soheil Hassas Yeganeh [this message]
2016-04-29 3:10 ` [PATCH v2 net-next 7/7] tcp: make tcp_sendmsg() aware of " Eric Dumazet
2016-04-29 4:43 ` Alexei Starovoitov
2016-04-29 5:05 ` Eric Dumazet
2016-04-29 5:19 ` Alexei Starovoitov
2016-04-29 13:13 ` Soheil Hassas Yeganeh
2016-04-29 20:39 ` [PATCH v2 net-next 0/7] net: make TCP preemptible David Miller
2016-04-29 20:53 ` Eric Dumazet
2016-04-30 9:57 ` Julian Anastasov
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=CACSApvbh0y9v2yHNDfajmdD5HN9rdR3hN5_BgHdjAihc+A8Nmg@mail.gmail.com \
--to=soheil@google.com \
--cc=ast@fb.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=eric.dumazet@gmail.com \
--cc=marcelo.leitner@gmail.com \
--cc=netdev@vger.kernel.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).