Skip to content

Commit

Permalink
vmalloc: allow to account vmalloc to memcg
Browse files Browse the repository at this point in the history
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: Vladimir Davydov <vdavydov@virtuozzo.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Cc: Greg Thelen <gthelen@google.com>
Cc: Christoph Lameter <cl@linux.com>
Cc: Pekka Enberg <penberg@kernel.org>
Cc: David Rientjes <rientjes@google.com>
Cc: Joonsoo Kim <iamjoonsoo.kim@lge.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Vladimir Davydov authored and torvalds committed Jan 15, 2016
1 parent 230e9fc commit 37f08dd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mm/vmalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1477,7 +1477,7 @@ static void __vunmap(const void *addr, int deallocate_pages)
struct page *page = area->pages[i];

BUG_ON(!page);
__free_page(page);
__free_kmem_pages(page, 0);
}

if (area->flags & VM_VPAGES)
Expand Down Expand Up @@ -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);
else
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() */
Expand Down

0 comments on commit 37f08dd

Please sign in to comment.