[Devel] [PATCH RHEL8 COMMIT] memcg: Corrected __GFP_ACCOUNT use in ipv6_add_addr()

Konstantin Khorenko khorenko at virtuozzo.com
Fri Apr 16 17:57:25 MSK 2021


The commit is pushed to "branch-rh8-4.18.0-240.1.1.vz8.5.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-240.1.1.vz8.5.14
------>
commit 55e044916e8c192aaf4151a71bbec1a073b63e0b
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Fri Apr 16 17:57:25 2021 +0300

    memcg: Corrected __GFP_ACCOUNT use in ipv6_add_addr()
    
    __GFP_ACCOUNT is required for ifa allocation only,
    following f6i allocation uses SLAB_ACCOUNT marked slab.
    
    https://jira.sw.ru/browse/PSBM-120694
    Fixes: 06fac184ac6b "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;


More information about the Devel mailing list