lkml.org 
[lkml]   [2018]   [Jan]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net] net: memcontrol: charge allocated memory after mem_cgroup_sk_alloc()
On Thu, Jan 25, 2018 at 12:03:02PM -0500, David Miller wrote:
> From: Roman Gushchin <guro@fb.com>
> Date: Thu, 25 Jan 2018 00:19:11 +0000
>
> > @@ -476,6 +477,10 @@ struct sock *inet_csk_accept(struct sock *sk, int flags, int *err, bool kern)
> > spin_unlock_bh(&queue->fastopenq.lock);
> > }
> > mem_cgroup_sk_alloc(newsk);
> > + amt = sk_memory_allocated(newsk);
> > + if (amt && newsk->sk_memcg)
> > + mem_cgroup_charge_skmem(newsk->sk_memcg, amt);
> > +
>
> This looks confusing to me.
>
> sk_memory_allocated() is the total amount of memory used by all
> sockets for a particular "struct proto", not just for that specific
> socket.

Oh, I see...

>
> Maybe I don't understand how this socket memcg stuff works, but it
> seems like you should be looking instead at how much memory is
> allocated to this specific socket.

Yes, this is what I wanted to do originally.
Let me find a proper way to do this.

Thank you!

Roman

\
 
 \ /
  Last update: 2018-01-25 18:17    [W:0.210 / U:0.232 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site