[Devel] [PATCH] net: fix silly mistake with TCP cgroup memory pressure check

Andrey Ryabinin aryabinin at virtuozzo.com
Fri May 26 06:22:09 PDT 2017


On 05/26/2017 03:59 PM, Stanislav Kinsburskiy wrote:
> Memmory pressure is referenced as a pointer in socket structure.
> Simple check for pointer address will always return true for each socket,
> allocated with enabled mem_cg.
> Memory pressure value has to checked instead.
> 
> https://jira.sw.ru/browse/PSBM-66468
> 
> Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>

Acked-by: Andrey Ryabinin <aryabinin at virtuozzo.com>

> ---
>  include/net/tcp.h |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/include/net/tcp.h b/include/net/tcp.h
> index d64d30b..f2b4843 100644
> --- a/include/net/tcp.h
> +++ b/include/net/tcp.h
> @@ -298,7 +298,7 @@ extern int tcp_memory_pressure;
>  static inline bool tcp_under_memory_pressure(const struct sock *sk)
>  {
>  	if (mem_cgroup_sockets_enabled && sk->sk_cgrp)
> -		return !!sk->sk_cgrp->memory_pressure;
> +		return *sk->sk_cgrp->memory_pressure;
>  
>  	return tcp_memory_pressure;
>  }
> 


More information about the Devel mailing list