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] [day] [month] [year] [list]
Message-ID: <55BFD4DF.30703@gmail.com>
Date:	Mon, 03 Aug 2015 16:53:51 -0400
From:	Jason Baron <jasonbaron0@...il.com>
To:	Eric Dumazet <edumazet@...gle.com>,
	"David S. Miller" <davem@...emloft.net>
CC:	netdev <netdev@...r.kernel.org>, Jason Baron <jbaron@...mai.com>,
	Neal Cardwell <ncardwell@...gle.com>,
	Yuchung Cheng <ycheng@...gle.com>,
	Eric Dumazet <eric.dumazet@...il.com>
Subject: Re: [PATCH v2 net-next 1/6] net: fix sk_mem_reclaim_partial()



On 05/15/2015 03:39 PM, Eric Dumazet wrote:
> sk_mem_reclaim_partial() goal is to ensure each socket has
> one SK_MEM_QUANTUM forward allocation. This is needed both for
> performance and better handling of memory pressure situations in
> follow up patches.
> 
> SK_MEM_QUANTUM is currently a page, but might be reduced to 4096 bytes
> as some arches have 64KB pages.
> 
> Signed-off-by: Eric Dumazet <edumazet@...gle.com>
> ---
>  include/net/sock.h | 6 +++---
>  net/core/sock.c    | 9 +++++----
>  2 files changed, 8 insertions(+), 7 deletions(-)
> 
> diff --git a/include/net/sock.h b/include/net/sock.h
> index d882f4c8e438..4581a60636f8 100644
> --- a/include/net/sock.h
> +++ b/include/net/sock.h
> @@ -1368,7 +1368,7 @@ static inline struct inode *SOCK_INODE(struct socket *socket)
>   * Functions for memory accounting
>   */
>  int __sk_mem_schedule(struct sock *sk, int size, int kind);
> -void __sk_mem_reclaim(struct sock *sk);
> +void __sk_mem_reclaim(struct sock *sk, int amount);
>  
>  #define SK_MEM_QUANTUM ((int)PAGE_SIZE)
>  #define SK_MEM_QUANTUM_SHIFT ilog2(SK_MEM_QUANTUM)
> @@ -1409,7 +1409,7 @@ static inline void sk_mem_reclaim(struct sock *sk)
>  	if (!sk_has_account(sk))
>  		return;
>  	if (sk->sk_forward_alloc >= SK_MEM_QUANTUM)
> -		__sk_mem_reclaim(sk);
> +		__sk_mem_reclaim(sk, sk->sk_forward_alloc);
>  }
>  
>  static inline void sk_mem_reclaim_partial(struct sock *sk)
> @@ -1417,7 +1417,7 @@ static inline void sk_mem_reclaim_partial(struct sock *sk)
>  	if (!sk_has_account(sk))
>  		return;
>  	if (sk->sk_forward_alloc > SK_MEM_QUANTUM)
> -		__sk_mem_reclaim(sk);
> +		__sk_mem_reclaim(sk, sk->sk_forward_alloc - 1);
>  }
>

Hi,

Was just looking at this again - this doesn't ensure the SK_MEM_QUANTUM
minimum as the comment suggests- should it be:

_sk_mem_reclaim(sk, sk->sk_forward_alloc - SK_MEM_QUANTUM);
					   ^^^^^^^^^^^^^^^

Or are you just trying to make sure its not 0?

Thanks,

-Jason
													

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