From: Eric Dumazet <eric.dumazet@gmail.com>
To: Cong Wang <xiyou.wangcong@gmail.com>
Cc: netdev@vger.kernel.org
Subject: Re: [PATCH net-next] igmp: hash a hash table to speedup ip_check_mc_rcu()
Date: Fri, 07 Jun 2013 22:23:13 -0700 [thread overview]
Message-ID: <1370668993.24311.460.camel@edumazet-glaptop> (raw)
In-Reply-To: <kouci0$2eu$1@ger.gmane.org>
On Sat, 2013-06-08 at 04:39 +0000, Cong Wang wrote:
> On Fri, 07 Jun 2013 at 15:48 GMT, Eric Dumazet <eric.dumazet@gmail.com> wrote:
> > diff --git a/include/linux/igmp.h b/include/linux/igmp.h
> > index 7f2bf15..e3362b5 100644
> > --- a/include/linux/igmp.h
> > +++ b/include/linux/igmp.h
> > @@ -84,6 +84,7 @@ struct ip_mc_list {
> > struct ip_mc_list *next;
> > struct ip_mc_list __rcu *next_rcu;
> > };
> > + struct ip_mc_list __rcu *next_hash;
>
>
> Why not put this into the above union?
>
Because it must be a different storage.
Read ip_mc_hash_add(), its pretty clear...
>
> > +static void ip_mc_hash_add(struct in_device *in_dev,
> > + struct ip_mc_list *im)
> > +{
> > + struct ip_mc_list __rcu **mc_hash;
> > + u32 hash;
> > +
> > + mc_hash = rtnl_dereference(in_dev->mc_hash);
> > + if (mc_hash) {
> > + hash = ip_mc_hash(im);
> > + im->next_hash = rtnl_dereference(mc_hash[hash]);
> > + rcu_assign_pointer(mc_hash[hash], im);
> > + return;
> > + }
> > +
> > + /* do not use a hash table for small number of items */
> > + if (in_dev->mc_count < 4)
> > + return;
>
>
> Can this check be moved to the beginning of this function?
Absolutely not.
Once hash table is created, all items must be inserted in,
because of RCU lookups.
next prev parent reply other threads:[~2013-06-08 5:23 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-05 17:57 Performance regression from routing cache removal? Shawn Bohrer
2013-06-05 18:13 ` Eric Dumazet
2013-06-05 20:32 ` Shawn Bohrer
2013-06-05 20:52 ` Eric Dumazet
2013-06-07 0:35 ` Eric Dumazet
2013-06-07 14:48 ` Shawn Bohrer
2013-06-07 15:48 ` [PATCH net-next] igmp: hash a hash table to speedup ip_check_mc_rcu() Eric Dumazet
2013-06-07 17:33 ` Shawn Bohrer
2013-06-08 4:39 ` Cong Wang
2013-06-08 5:23 ` Eric Dumazet [this message]
2013-06-10 1:58 ` Cong Wang
2013-06-12 7:26 ` 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=1370668993.24311.460.camel@edumazet-glaptop \
--to=eric.dumazet@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=xiyou.wangcong@gmail.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