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

Konstantin Khorenko khorenko at virtuozzo.com
Thu Apr 11 15:56:01 MSK 2019


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;
 
-- 
2.15.1



More information about the Devel mailing list