linux/net/core
Shakeel Butt d752a49865 net: memcg: late association of sock to memcg
If a TCP socket is allocated in IRQ context or cloned from unassociated
(i.e. not associated to a memcg) in IRQ context then it will remain
unassociated for its whole life. Almost half of the TCPs created on the
system are created in IRQ context, so, memory used by such sockets will
not be accounted by the memcg.

This issue is more widespread in cgroup v1 where network memory
accounting is opt-in but it can happen in cgroup v2 if the source socket
for the cloning was created in root memcg.

To fix the issue, just do the association of the sockets at the accept()
time in the process context and then force charge the memory buffer
already used and reserved by the socket.

Signed-off-by: Shakeel Butt <shakeelb@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2020-03-10 15:33:05 -07:00
..
bpf_sk_storage.c bpf: Improve bucket_log calculation logic 2020-02-07 23:01:41 +01:00
datagram.c
datagram.h
dev_addr_lists.c
dev_ioctl.c
dev.c net: Fix Tx hash bound checking 2020-02-26 11:14:10 -08:00
devlink.c devlink: validate length of region addr/len 2020-03-03 13:28:48 -08:00
drop_monitor.c drop_monitor: Do not cancel uninitialized work item 2020-02-07 18:48:36 +01:00
dst_cache.c
dst.c
failover.c
fib_notifier.c
fib_rules.c net: fib_rules: Correctly set table field when table number exceeds 8 bits 2020-02-16 18:38:24 -08:00
filter.c treewide: remove redundant IS_ERR() before error code check 2020-02-04 03:05:27 +00:00
flow_dissector.c flow_dissector: Fix to use new variables for port ranges in bpf hook 2020-01-27 11:25:07 +01:00
flow_offload.c
gen_estimator.c
gen_stats.c
gro_cells.c
hwbm.c
link_watch.c
lwt_bpf.c
lwtunnel.c
Makefile
neighbour.c
net_namespace.c
net-procfs.c
net-sysfs.c
net-sysfs.h
net-traces.c
netclassid_cgroup.c cgroup, netclassid: periodically release file_lock on classid updating 2020-03-09 18:13:39 -07:00
netevent.c
netpoll.c
netprio_cgroup.c
page_pool.c page_pool: refill page when alloc.count of pool is zero 2020-02-13 14:11:51 -08:00
pktgen.c proc: convert everything to "struct proc_ops" 2020-02-04 03:05:26 +00:00
ptp_classifier.c
request_sock.c
rtnetlink.c net: rtnetlink: fix bugs in rtnl_alt_ifname() 2020-02-16 18:51:59 -08:00
scm.c
secure_seq.c
skbuff.c net: core: Distribute switch variables for initialization 2020-02-20 10:00:19 -08:00
skmsg.c
sock_diag.c
sock_map.c bpf, sockhash: Synchronize_rcu before free'ing map 2020-02-07 22:36:26 +01:00
sock_reuseport.c soreuseport: Cleanup duplicate initialization of more_reuse->max_socks. 2020-01-27 11:01:16 +01:00
sock.c net: memcg: late association of sock to memcg 2020-03-10 15:33:05 -07:00
stream.c
sysctl_net_core.c
timestamping.c
tso.c
utils.c
xdp.c