mm: Expose lazy vfree pages to control via sysctl
Hiroshi Doyu [Fri, 12 Apr 2013 09:43:43 +0000 (12:43 +0300)]
Create "/proc/sys/lazy_vfree_pages" file to control lazy vfree pages

Bug 1238957

Change-Id: I75a296ae035d8cedb817319d8f4a5579ae6cf1ba
Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com>
Reviewed-on: http://git-master/r/289616
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Krishna Reddy <vdumpa@nvidia.com>

kernel/sysctl.c
mm/vmalloc.c

index 1a07798..cbbd2a0 100644 (file)
@@ -95,6 +95,7 @@
 #if defined(CONFIG_SYSCTL)
 
 /* External variables not in a header file. */
+extern int sysctl_lazy_vfree_pages;
 extern int sysctl_overcommit_memory;
 extern int sysctl_overcommit_ratio;
 extern int max_threads;
@@ -1069,6 +1070,13 @@ static struct ctl_table kern_table[] = {
 
 static struct ctl_table vm_table[] = {
        {
+               .procname       = "lazy_vfree_pages",
+               .data           = &sysctl_lazy_vfree_pages,
+               .maxlen         = sizeof(sysctl_lazy_vfree_pages),
+               .mode           = 0644,
+               .proc_handler   = proc_dointvec,
+       },
+       {
                .procname       = "overcommit_memory",
                .data           = &sysctl_overcommit_memory,
                .maxlen         = sizeof(sysctl_overcommit_memory),
index d365724..396c71c 100644 (file)
@@ -552,13 +552,16 @@ static void vmap_debug_free_range(unsigned long start, unsigned long end)
  * code, and it will be simple to change the scale factor if we find that it
  * becomes a problem on bigger systems.
  */
+
+int sysctl_lazy_vfree_pages = 32UL * 1024 * 1024 / PAGE_SIZE;
+
 static unsigned long lazy_max_pages(void)
 {
        unsigned int log;
 
        log = fls(num_online_cpus());
 
-       return log * (32UL * 1024 * 1024 / PAGE_SIZE);
+       return log * sysctl_lazy_vfree_pages;
 }
 
 static atomic_t vmap_lazy_nr = ATOMIC_INIT(0);