lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <kouci0$2eu$1@ger.gmane.org>
Date:	Sat, 8 Jun 2013 04:39:29 +0000 (UTC)
From:	Cong Wang <xiyou.wangcong@...il.com>
To:	netdev@...r.kernel.org
Subject: Re: [PATCH net-next] igmp: hash a hash table to speedup
 ip_check_mc_rcu()

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?


> +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!

--
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

Powered by Openwall GNU/*/Linux Powered by OpenVZ