net: enable memcg accounting for veth queues
authorVasily Averin <vvs@openvz.org>
Fri, 29 Apr 2022 05:17:35 +0000 (08:17 +0300)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 May 2022 12:15:16 +0000 (13:15 +0100)
veth netdevice defines own rx queues and allocates array containing
up to 4095 ~750-bytes-long 'struct veth_rq' elements. Such allocation
is quite huge and should be accounted to memcg.

Signed-off-by: Vasily Averin <vvs@openvz.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/veth.c

index eb0121a..3592014 100644 (file)
@@ -1375,7 +1375,7 @@ static int veth_alloc_queues(struct net_device *dev)
        struct veth_priv *priv = netdev_priv(dev);
        int i;
 
-       priv->rq = kcalloc(dev->num_rx_queues, sizeof(*priv->rq), GFP_KERNEL);
+       priv->rq = kcalloc(dev->num_rx_queues, sizeof(*priv->rq), GFP_KERNEL_ACCOUNT);
        if (!priv->rq)
                return -ENOMEM;