[Devel,RHEL7,COMMIT] net: fix silly mistake with TCP cgroup memory pressure check

Submitted by Konstantin Khorenko on May 26, 2017, 1:59 p.m.

Details

Message ID 201705261359.v4QDxlVt026450@finist_cl7.x64_64.work.ct
State New
Series "net: fix silly mistake with TCP cgroup memory pressure check"
Headers show

Commit Message

Konstantin Khorenko May 26, 2017, 1:59 p.m.
The commit is pushed to "branch-rh7-3.10.0-514.16.1.vz7.32.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.16.1.vz7.32.4
------>
commit 4ce6f75421155583e24d9d763de8f48c2d3fec16
Author: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
Date:   Fri May 26 17:59:47 2017 +0400

    net: fix silly mistake with TCP cgroup memory pressure check
    
    Memory 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@virtuozzo.com>
    Acked-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 include/net/tcp.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch hide | download patch | download mbox

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

Comments

Konstantin Khorenko May 30, 2017, 11:49 a.m.
Please consider to create a ReadyKernel patch for it.

https://readykernel.com/

--
Best regards,

Konstantin Khorenko,
Virtuozzo Linux Kernel Team

On 05/26/2017 04:59 PM, Konstantin Khorenko wrote:
> The commit is pushed to "branch-rh7-3.10.0-514.16.1.vz7.32.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
> after rh7-3.10.0-514.16.1.vz7.32.4
> ------>
> commit 4ce6f75421155583e24d9d763de8f48c2d3fec16
> Author: Stanislav Kinsburskiy <skinsbursky@virtuozzo.com>
> Date:   Fri May 26 17:59:47 2017 +0400
>
>     net: fix silly mistake with TCP cgroup memory pressure check
>
>     Memory 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@virtuozzo.com>
>     Acked-by: Andrey Ryabinin <aryabinin@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;
>  }
> .
>