Subject: Re: [PATCH v2 net] tcp: md5: do not use alloc_percpu()

From: David Ahern <[email-masked]>
Date: Thu, 23 Oct 2014 14:44:11 -0600

On 10/23/14, 1:58 PM, Eric Dumazet wrote:
> diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c
> index 1bec4e76d88c..39ec0c379545 100644
> --- a/net/ipv4/tcp.c
> +++ b/net/ipv4/tcp.c
> @@ -2868,61 +2868,42 @@ EXPORT_SYMBOL(compat_tcp_getsockopt);
>   #endif
>
>   #ifdef CONFIG_TCP_MD5SIG
> -static struct tcp_md5sig_pool __percpu *tcp_md5sig_pool __read_mostly;
> +static DEFINE_PER_CPU(struct tcp_md5sig_pool, tcp_md5sig_pool);
>   static DEFINE_MUTEX(tcp_md5sig_mutex);
> -
> -static void __tcp_free_md5sig_pool(struct tcp_md5sig_pool __percpu *pool)
> -{
> -	int cpu;
> -
> -	for_each_possible_cpu(cpu) {
> -		struct tcp_md5sig_pool *p = per_cpu_ptr(pool, cpu);
> -
> -		if (p->md5_desc.tfm)
> -			crypto_free_hash(p->md5_desc.tfm);
> -	}
> -	free_percpu(pool);
> -}
> +static bool tcp_md5sig_pool_populated = false;

global variables do not need to be initialized to 0.

I'll see how this applies to v3.4 and build an image.

Thanks,
David