instrument mmap slow path (testing only)
diff --git a/mm/mmap.c b/mm/mmap.c
index 5cd2b88..501551b 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -24,6 +24,7 @@
#include <linux/security.h>
#include <linux/hugetlb.h>
#include <linux/profile.h>
+#include <linux/moduleparam.h>
#include <linux/export.h>
#include <linux/mount.h>
#include <linux/mempolicy.h>
@@ -112,6 +113,11 @@
}
EXPORT_SYMBOL_GPL(vm_memory_committed);
+static DEFINE_PER_CPU(long, stat_vem_total);
+module_param_cb(vem_total, ¶m_ops_percpu_uint, &stat_vem_total, 0644);
+static DEFINE_PER_CPU(long, stat_vem_slow);
+module_param_cb(vem_slow, ¶m_ops_percpu_uint, &stat_vem_slow, 0644);
+
/*
* Check that a process has enough memory to allocate a new virtual
* mapping. 0 means there is enough memory for the allocation to
@@ -143,6 +149,8 @@
if (sysctl_overcommit_memory == OVERCOMMIT_GUESS) {
long extra = totalreserve_pages;
+ __this_cpu_inc(stat_vem_total);
+
/*
* Reserve some for root
*/
@@ -166,6 +174,8 @@
/* Slow path. */
+ __this_cpu_inc(stat_vem_slow);
+
free = global_page_state(NR_FREE_PAGES);
free += global_page_state(NR_FILE_PAGES);