[Devel] [PATCH RHEL7 COMMIT] mm/netlink: Make all netlink skb memory be kmem accounted

Konstantin Khorenko khorenko at virtuozzo.com
Mon Apr 15 15:48:04 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-957.10.1.vz7.94.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-957.10.1.vz7.94.13
------>
commit b9cb7cedbe77a7ed71c574ffb4108abfdfdfdd7b
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Thu Apr 11 15:46:43 2019 +0300

    mm/netlink: Make all netlink skb memory be kmem accounted
    
    At the moment we are able to account vmalloc() memory,
    so drop prohibition of using vmalloc() for big netlink messages in
    Containers and update allocation flags up to accountable version.
    
    As a side result we get rid of high order pages allocations for big
    netlink messages.
    
    Fixes: 84708b8d44e9 ("mm/netlink: Make all in-cg memory be kmem
    accounted")
    https://jira.sw.ru/browse/PSBM-93761
    
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 net/netlink/af_netlink.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index c081efe043db..615e10642431 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -1054,19 +1054,13 @@ static struct sk_buff *netlink_alloc_large_skb(unsigned int size,
 	struct sk_buff *skb;
 	void *data;
 
-	if (size <= NLMSG_GOODSIZE || broadcast ||
-			/*
-			 * Once we have vmalloc_kmem() that would account
-			 * allocated pages into memcg, this check can be
-			 * removed.
-			 */
-			!ve_is_super(get_exec_env()))
-		return alloc_skb(size, GFP_KERNEL);
+	if (size <= NLMSG_GOODSIZE || broadcast)
+		return alloc_skb(size, GFP_KERNEL_ACCOUNT);
 
 	size = SKB_DATA_ALIGN(size) +
 	       SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
 
-	data = vmalloc(size);
+	data = __vmalloc(size, GFP_KERNEL_ACCOUNT | __GFP_HIGHMEM, PAGE_KERNEL);
 	if (data == NULL)
 		return NULL;
 



More information about the Devel mailing list