OSDN Git Service

memcg: enable accounting for net_device and Tx/Rx queues
authorVasily Averin <vvs@virtuozzo.com>
Mon, 19 Jul 2021 10:44:23 +0000 (13:44 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Jul 2021 13:00:38 +0000 (06:00 -0700)
commitc948f51c1654218af2161840014c9dcbf7c89464
tree3740035e0684a32cfa86e1e41da7eca590284fa6
parent2967eed908020ea997044d6f2ef9ebbca0e0e8e9
memcg: enable accounting for net_device and Tx/Rx queues

Container netadmin can create a lot of fake net devices,
then create a new net namespace and repeat it again and again.
Net device can request the creation of up to 4096 tx and rx queues,
and force kernel to allocate up to several tens of megabytes memory
per net device.

It makes sense to account for them to restrict the host's memory
consumption from inside the memcg-limited container.

Signed-off-by: Vasily Averin <vvs@virtuozzo.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c