[Devel] [PATCH RH8] memcg: corrected __GFP_ACCOUNT use in ipv6_add_addr()

Vasily Averin vvs at virtuozzo.com
Thu Apr 15 09:36:25 MSK 2021


__GFP_ACCOUNT is required for ifa allocation only,
following f6i allocation uses SLAB_ACCOUNT marked slab.

https://jira.sw.ru/browse/PSBM-120694
Fixes: "memcg: charge kmem allocations accounted to UBC in PCS6 to memcg"
Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 net/ipv6/addrconf.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index 2ad863caacaf..eacbb9b2a0e9 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -1040,8 +1040,7 @@ static struct inet6_ifaddr *
 ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg,
 	      bool can_block, struct netlink_ext_ack *extack)
 {
-	gfp_t gfp_flags = (can_block ? GFP_KERNEL : GFP_ATOMIC) |
-			   __GFP_ACCOUNT;
+	gfp_t gfp_flags = can_block ? GFP_KERNEL : GFP_ATOMIC;
 	int addr_type = ipv6_addr_type(cfg->pfx);
 	struct net *net = dev_net(idev->dev);
 	struct inet6_ifaddr *ifa = NULL;
@@ -1081,7 +1080,7 @@ ipv6_add_addr(struct inet6_dev *idev, struct ifa6_config *cfg,
 			goto out;
 	}
 
-	ifa = kzalloc(sizeof(*ifa), gfp_flags);
+	ifa = kzalloc(sizeof(*ifa), gfp_flags | __GFP_ACCOUNT);
 	if (!ifa) {
 		err = -ENOBUFS;
 		goto out;
-- 
2.25.1



More information about the Devel mailing list