[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1370668993.24311.460.camel@edumazet-glaptop>
Date: Fri, 07 Jun 2013 22:23:13 -0700
From: Eric Dumazet <eric.dumazet@...il.com>
To: Cong Wang <xiyou.wangcong@...il.com>
Cc: netdev@...r.kernel.org
Subject: Re: [PATCH net-next] igmp: hash a hash table to speedup
ip_check_mc_rcu()
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@...il.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.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists