Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1405345 > unrolled thread

[PATCH 8/8] af_unix: charge buffers to kmemcg

Started byVladimir Davydov <vdavydov@virtuozzo.com>
First post2016-05-23 15:00 +0200
Last post2016-05-24 10:00 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 8/8] af_unix: charge buffers to kmemcg Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-23 15:00 +0200
    Re: [PATCH 8/8] af_unix: charge buffers to kmemcg David Miller <davem@davemloft.net> - 2016-05-24 00:20 +0200
    Re: [PATCH 8/8] af_unix: charge buffers to kmemcg Vladimir Davydov <vdavydov@virtuozzo.com> - 2016-05-24 10:00 +0200

#1405345 — [PATCH 8/8] af_unix: charge buffers to kmemcg

FromVladimir Davydov <vdavydov@virtuozzo.com>
Date2016-05-23 15:00 +0200
Subject[PATCH 8/8] af_unix: charge buffers to kmemcg
Message-ID<rBXCH-5ZQ-31@gated-at.bofh.it>
Unix sockets can consume a significant amount of system memory, hence
they should be accounted to kmemcg.

Since unix socket buffers are always allocated from process context,
all we need to do to charge them to kmemcg is set __GFP_ACCOUNT in
sock->sk_allocation mask.

Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
Cc: "David S. Miller" <davem@davemloft.net>
---
 net/unix/af_unix.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
index 80aa6a3e6817..022bdd3ab7d9 100644
--- a/net/unix/af_unix.c
+++ b/net/unix/af_unix.c
@@ -769,6 +769,7 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
 	lockdep_set_class(&sk->sk_receive_queue.lock,
 				&af_unix_sk_receive_queue_lock_key);
 
+	sk->sk_allocation	= GFP_KERNEL_ACCOUNT;
 	sk->sk_write_space	= unix_write_space;
 	sk->sk_max_ack_backlog	= net->unx.sysctl_max_dgram_qlen;
 	sk->sk_destruct		= unix_sock_destructor;
-- 
2.1.4

[toc] | [next] | [standalone]


#1405694

FromDavid Miller <davem@davemloft.net>
Date2016-05-24 00:20 +0200
Message-ID<rC6mB-3cQ-7@gated-at.bofh.it>
In reply to#1405345
Networking changes should be CC:'d netdev@vger.kernel.org

[toc] | [prev] | [next] | [standalone]


#1405916

FromVladimir Davydov <vdavydov@virtuozzo.com>
Date2016-05-24 10:00 +0200
Message-ID<rCfpU-sX-15@gated-at.bofh.it>
In reply to#1405345
[adding netdev to Cc]

On Mon, May 23, 2016 at 01:20:29PM +0300, Vladimir Davydov wrote:
> Unix sockets can consume a significant amount of system memory, hence
> they should be accounted to kmemcg.
> 
> Since unix socket buffers are always allocated from process context,
> all we need to do to charge them to kmemcg is set __GFP_ACCOUNT in
> sock->sk_allocation mask.
> 
> Signed-off-by: Vladimir Davydov <vdavydov@virtuozzo.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> ---
>  net/unix/af_unix.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c
> index 80aa6a3e6817..022bdd3ab7d9 100644
> --- a/net/unix/af_unix.c
> +++ b/net/unix/af_unix.c
> @@ -769,6 +769,7 @@ static struct sock *unix_create1(struct net *net, struct socket *sock, int kern)
>  	lockdep_set_class(&sk->sk_receive_queue.lock,
>  				&af_unix_sk_receive_queue_lock_key);
>  
> +	sk->sk_allocation	= GFP_KERNEL_ACCOUNT;
>  	sk->sk_write_space	= unix_write_space;
>  	sk->sk_max_ack_backlog	= net->unx.sysctl_max_dgram_qlen;
>  	sk->sk_destruct		= unix_sock_destructor;

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web