From: Cong Wang <xiyou.wangcong@gmail.com>
To: netdev@vger.kernel.org
Subject: Re: [PATCH net-next] igmp: hash a hash table to speedup ip_check_mc_rcu()
Date: Sat, 8 Jun 2013 04:39:29 +0000 (UTC) [thread overview]
Message-ID: <kouci0$2eu$1@ger.gmane.org> (raw)
In-Reply-To: 1370620137.24311.433.camel@edumazet-glaptop
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?
> +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?
> +
> + mc_hash = kzalloc(sizeof(struct ip_mc_list *) << MC_HASH_SZ_LOG,
> + GFP_KERNEL);
> + if (!mc_hash)
> + return;
> +
> + for_each_pmc_rtnl(in_dev, im) {
> + hash = ip_mc_hash(im);
> + im->next_hash = rtnl_dereference(mc_hash[hash]);
> + RCU_INIT_POINTER(mc_hash[hash], im);
> + }
> +
> + rcu_assign_pointer(in_dev->mc_hash, mc_hash);
> +}
> +
Thanks!
next prev parent reply other threads:[~2013-06-08 4:39 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 [this message]
2013-06-08 5:23 ` Eric Dumazet
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='kouci0$2eu$1@ger.gmane.org' \
--to=xiyou.wangcong@gmail.com \
--cc=netdev@vger.kernel.org \
/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