[Devel] [PATCH RHEL7 COMMIT] vmalloc: add v[mz]alloc_account helpers

Konstantin Khorenko khorenko at virtuozzo.com
Mon May 2 07:06:04 PDT 2016


The commit is pushed to "branch-rh7-3.10.0-327.10.1.vz7.12.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-327.10.1.vz7.12.16
------>
commit 711dc0b092af3ff875c85e94829913301e5187c9
Author: Vladimir Davydov <vdavydov at virtuozzo.com>
Date:   Mon May 2 18:06:04 2016 +0400

    vmalloc: add v[mz]alloc_account helpers
    
    Same as v[mz]alloc, but accounted to kmemcg. Will be used later.
    
    Signed-off-by: Vladimir Davydov <vdavydov at virtuozzo.com>
---
 include/linux/vmalloc.h |  2 ++
 mm/vmalloc.c            | 14 ++++++++++++++
 2 files changed, 16 insertions(+)

diff --git a/include/linux/vmalloc.h b/include/linux/vmalloc.h
index 97b987f..6ea82cf 100644
--- a/include/linux/vmalloc.h
+++ b/include/linux/vmalloc.h
@@ -68,6 +68,8 @@ static inline void vmalloc_init(void)
 
 extern void *vmalloc(unsigned long size);
 extern void *vzalloc(unsigned long size);
+extern void *vmalloc_account(unsigned long size);
+extern void *vzalloc_account(unsigned long size);
 extern void *vmalloc_user(unsigned long size);
 extern void *vmalloc_node(unsigned long size, int node);
 extern void *vzalloc_node(unsigned long size, int node);
diff --git a/mm/vmalloc.c b/mm/vmalloc.c
index 32d3744..a8c2b28 100644
--- a/mm/vmalloc.c
+++ b/mm/vmalloc.c
@@ -1782,6 +1782,20 @@ void *vzalloc(unsigned long size)
 }
 EXPORT_SYMBOL(vzalloc);
 
+void *vmalloc_account(unsigned long size)
+{
+	return __vmalloc_node_flags(size, NUMA_NO_NODE,
+			GFP_KERNEL_ACCOUNT | __GFP_HIGHMEM);
+}
+EXPORT_SYMBOL(vmalloc_account);
+
+void *vzalloc_account(unsigned long size)
+{
+	return __vmalloc_node_flags(size, NUMA_NO_NODE,
+			GFP_KERNEL_ACCOUNT | __GFP_HIGHMEM | __GFP_ZERO);
+}
+EXPORT_SYMBOL(vzalloc_account);
+
 /**
  * vmalloc_user - allocate zeroed virtually contiguous memory for userspace
  * @size: allocation size


More information about the Devel mailing list