public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Stephen Hemminger <shemminger@vyatta•com>
To: davem@davemloft•net
Cc: netdev@vger•kernel.org
Subject: [PATCH 2/2] netlink: wake up netlink listeners sooner (v2)
Date: Thu, 22 Dec 2011 10:52:03 -0800	[thread overview]
Message-ID: <20111222185217.507023273@vyatta.com> (raw)
In-Reply-To: 20111222185201.592156795@vyatta.com

[-- Attachment #1: netlink-congest.patch --]
[-- Type: text/plain, Size: 712 bytes --]

This patch changes it to yield sooner at halfway instead. Still not a cure-all
for listener overrun if listner is slow, but works much reliably.

Signed-off-by: Stephen Hemminger <shemminger@vyatta•com>

---
v2 - use shift to avoid expensive integer division

--- a/net/netlink/af_netlink.c	2011-12-21 15:15:09.446373421 -0800
+++ b/net/netlink/af_netlink.c	2011-12-21 15:22:35.632062577 -0800
@@ -959,7 +959,7 @@ static int netlink_broadcast_deliver(str
 		skb_set_owner_r(skb, sk);
 		skb_queue_tail(&sk->sk_receive_queue, skb);
 		sk->sk_data_ready(sk, skb->len);
-		return atomic_read(&sk->sk_rmem_alloc) > sk->sk_rcvbuf;
+		return atomic_read(&sk->sk_rmem_alloc) > (sk->sk_rcvbuf >> 1);
 	}
 	return -1;
 }

  parent reply	other threads:[~2011-12-22 18:53 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-22 18:52 [PATCH 0/2] netlink patches Stephen Hemminger
2011-12-22 18:52 ` [PATCH 1/2] netlink: af_netlink cleanup (v2) Stephen Hemminger
2011-12-23  3:37   ` David Miller
2011-12-22 18:52 ` Stephen Hemminger [this message]
2011-12-23  3:38   ` [PATCH 2/2] netlink: wake up netlink listeners sooner (v2) David Miller

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=20111222185217.507023273@vyatta.com \
    --to=shemminger@vyatta$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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