From: David Miller <davem@davemloft.net>
To: drheld@google.com
Cc: netdev@vger.kernel.org, eric.dumazet@gmail.com, willemb@google.com
Subject: Re: [PATCH net-next 1/2] udp: Simplify __udp*_lib_mcast_deliver.
Date: Tue, 15 Jul 2014 17:14:31 -0700 (PDT) [thread overview]
Message-ID: <20140715.171431.1611412835087664432.davem@davemloft.net> (raw)
In-Reply-To: <1405377039-10082-1-git-send-email-drheld@google.com>
From: David Held <drheld@google.com>
Date: Mon, 14 Jul 2014 18:30:38 -0400
> spin_lock(&hslot->lock);
> - sk = sk_nulls_head(&hslot->head);
> - dif = skb->dev->ifindex;
> - sk = udp_v4_mcast_next(net, sk, uh->dest, daddr, uh->source, saddr, dif);
> - while (sk) {
> - stack[count++] = sk;
> - sk = udp_v4_mcast_next(net, sk_nulls_next(sk), uh->dest,
> - daddr, uh->source, saddr, dif);
> - if (unlikely(count == ARRAY_SIZE(stack))) {
> - if (!sk)
> - break;
> - flush_stack(stack, count, skb, ~0);
> - count = 0;
> + sk_nulls_for_each(sk, node, &hslot->head) {
> + if (__udp_is_mcast_sock(net, sk,
> + uh->dest, daddr,
> + uh->source, saddr,
> + dif, hnum)) {
> + stack[count++] = sk;
> + if (unlikely(count == ARRAY_SIZE(stack))) {
> + flush_stack(stack, count, skb, ~0);
> + count = 0;
> + }
> }
> }
I think you are changing the logic of the loop in the edge case.
If we have exactly ARRAY_SIZE(stack) sockets to process, the old code
performs the flush_stack() outside of the hslot->lock, but with your
change we'll do it inside the lock.
The tradeoff here is reducing hslot->lock hold times vs. avoiding
taking a hold on all the sockets in the stack[] array.
I just wanted to point this out and make sure you are aware of and
are ok with this.
next prev parent reply other threads:[~2014-07-16 0:14 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-14 22:30 [PATCH net-next 1/2] udp: Simplify __udp*_lib_mcast_deliver David Held
2014-07-14 22:30 ` [PATCH net-next 2/2] udp: Use hash2 for long hash1 chains in __udp*_lib_mcast_deliver David Held
2014-07-15 8:33 ` Eric Dumazet
2014-07-15 13:48 ` David Held
2014-07-16 0:14 ` David Miller [this message]
2014-07-16 1:53 ` [PATCH net-next 1/2] udp: Simplify __udp*_lib_mcast_deliver David Held
2014-07-16 3:23 ` David Held
2014-07-16 6:58 ` Eric Dumazet
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=20140715.171431.1611412835087664432.davem@davemloft.net \
--to=davem@davemloft.net \
--cc=drheld@google.com \
--cc=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=willemb@google.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).