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

Submitted by Konstantin Khorenko on April 11, 2019, 12:56 p.m.

Details

Message ID 20190411125601.23430-1-khorenko@virtuozzo.com
State New
Series "mm/netlink: Make all netlink skb memory be kmem accounted"
Headers show

Commit Message

Konstantin Khorenko April 11, 2019, 12:56 p.m.
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@virtuozzo.com>
---
 net/netlink/af_netlink.c | 12 +++---------
 1 file changed, 3 insertions(+), 9 deletions(-)

Patch hide | download patch | download mbox

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;