Commit 37f08dda authored by Vladimir Davydov's avatar Vladimir Davydov Committed by Linus Torvalds
Browse files

vmalloc: allow to account vmalloc to memcg

Make vmalloc family functions allocate vmalloc area pages with
alloc_kmem_pages so that if __GFP_ACCOUNT is set they will be accounted
to memcg.  This is needed, at least, to account alloc_fdmem allocations.
Signed-off-by: default avatarVladimir Davydov <>
Acked-by: default avatarJohannes Weiner <>
Cc: Michal Hocko <>
Cc: Tejun Heo <>
Cc: Greg Thelen <>
Cc: Christoph Lameter <>
Cc: Pekka Enberg <>
Cc: David Rientjes <>
Cc: Joonsoo Kim <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent 230e9fc2
......@@ -1477,7 +1477,7 @@ static void __vunmap(const void *addr, int deallocate_pages)
struct page *page = area->pages[i];
__free_kmem_pages(page, 0);
if (area->flags & VM_VPAGES)
......@@ -1608,9 +1608,9 @@ static void *__vmalloc_area_node(struct vm_struct *area, gfp_t gfp_mask,
struct page *page;
if (node == NUMA_NO_NODE)
page = alloc_page(alloc_mask);
page = alloc_kmem_pages(alloc_mask, order);
page = alloc_pages_node(node, alloc_mask, order);
page = alloc_kmem_pages_node(node, alloc_mask, order);
if (unlikely(!page)) {
/* Successfully allocated i pages, free them in __vunmap() */
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment