netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: shemminger@vyatta.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH 3/3] netlink: wake up netlink listeners sooner
Date: Wed, 21 Dec 2011 18:00:11 -0500 (EST)	[thread overview]
Message-ID: <20111221.180011.42058520996715557.davem@davemloft.net> (raw)
In-Reply-To: <20111221134944.52223cdf@nehalam.linuxnetplumber.net>

From: Stephen Hemminger <shemminger@vyatta.com>
Date: Wed, 21 Dec 2011 13:49:44 -0800

> @@ -960,7 +960,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 / 2;
>  	}

Please mirror the logic we use in the generic socket code to do this
on the send side, namely use something like:

		return (atomic_read(&sk->sk_rmem_alloc) << 1) > sk->sk_rcvbuf;

because sk_rcvbuf is an int and this "/ 2" expression will generate a
really silly sequence of multiple shifts, adds, and comparisons in
order to handle negative values correctly.

      reply	other threads:[~2011-12-21 23:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-21 21:49 [PATCH 3/3] netlink: wake up netlink listeners sooner Stephen Hemminger
2011-12-21 23:00 ` David Miller [this message]

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=20111221.180011.42058520996715557.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=shemminger@vyatta.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;
as well as URLs for NNTP newsgroup(s).