OSDN Git Service

memcg: enable accounting for VLAN group array
authorVasily Averin <vvs@virtuozzo.com>
Mon, 19 Jul 2021 10:44:44 +0000 (13:44 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Jul 2021 13:00:38 +0000 (06:00 -0700)
vlan array consume up to 8 pages of 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/8021q/vlan.c

index 4cdf841..55275ef 100644 (file)
@@ -67,7 +67,7 @@ static int vlan_group_prealloc_vid(struct vlan_group *vg,
                return 0;
 
        size = sizeof(struct net_device *) * VLAN_GROUP_ARRAY_PART_LEN;
-       array = kzalloc(size, GFP_KERNEL);
+       array = kzalloc(size, GFP_KERNEL_ACCOUNT);
        if (array == NULL)
                return -ENOBUFS;