diff mbox

[v2,4/10] netlink: Use default rhashtable hashfn

Message ID E1YZara-0000vP-C0@gondolin.me.apana.org.au
State Changes Requested, archived
Delegated to: David Miller
Headers show

Commit Message

Herbert Xu March 22, 2015, 8:04 a.m. UTC
This patch removes the explicit jhash value for the hashfn parameter
of rhashtable.  The default is now jhash so removing the setting
makes no difference apart from making one less copy of jhash in
the kernel.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
---

 net/netlink/af_netlink.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

Thomas Graf March 22, 2015, 11:55 a.m. UTC | #1
On 03/22/15 at 07:04pm, Herbert Xu wrote:
> This patch removes the explicit jhash value for the hashfn parameter
> of rhashtable.  The default is now jhash so removing the setting
> makes no difference apart from making one less copy of jhash in
> the kernel.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

Acked-by: Thomas Graf <tgraf@suug.ch>
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Simon Horman March 23, 2015, 1:18 a.m. UTC | #2
Hi Herbert,

On Sun, Mar 22, 2015 at 07:04:02PM +1100, Herbert Xu wrote:
> This patch removes the explicit jhash value for the hashfn parameter
> of rhashtable.  The default is now jhash so removing the setting
> makes no difference apart from making one less copy of jhash in
> the kernel.
> 
> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
> ---
> 
>  net/netlink/af_netlink.c |    3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
> index 6517921..e2f7f28 100644
> --- a/net/netlink/af_netlink.c
> +++ b/net/netlink/af_netlink.c
> @@ -3133,13 +3133,12 @@ static inline u32 netlink_hash(const void *data, u32 seed)
>  	struct netlink_compare_arg arg;
>  
>  	netlink_compare_arg_init(&arg, sock_net(&nlk->sk), nlk->portid);
> -	return jhash(&arg, netlink_compare_arg_len, seed);
> +	return jhash2((u32 *)&arg, netlink_compare_arg_len / sizeof(u32), seed);

I understand the above change in the context of the rest of the series,
however, it does not seem to match up with the changelog for this patch.

>  }
>  
>  static const struct rhashtable_params netlink_rhashtable_params = {
>  	.head_offset = offsetof(struct netlink_sock, node),
>  	.key_len = netlink_compare_arg_len,
> -	.hashfn = jhash,
>  	.obj_hashfn = netlink_hash,
>  	.obj_cmpfn = netlink_compare,
>  	.max_size = 65536,
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Herbert Xu March 23, 2015, 12:56 p.m. UTC | #3
On Mon, Mar 23, 2015 at 10:18:21AM +0900, Simon Horman wrote:
>
> I understand the above change in the context of the rest of the series,
> however, it does not seem to match up with the changelog for this patch.

OK I will update the changelog.

Thanks,
diff mbox

Patch

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 6517921..e2f7f28 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -3133,13 +3133,12 @@  static inline u32 netlink_hash(const void *data, u32 seed)
 	struct netlink_compare_arg arg;
 
 	netlink_compare_arg_init(&arg, sock_net(&nlk->sk), nlk->portid);
-	return jhash(&arg, netlink_compare_arg_len, seed);
+	return jhash2((u32 *)&arg, netlink_compare_arg_len / sizeof(u32), seed);
 }
 
 static const struct rhashtable_params netlink_rhashtable_params = {
 	.head_offset = offsetof(struct netlink_sock, node),
 	.key_len = netlink_compare_arg_len,
-	.hashfn = jhash,
 	.obj_hashfn = netlink_hash,
 	.obj_cmpfn = netlink_compare,
 	.max_size = 65536,