aboutsummaryrefslogtreecommitdiffstats
path: root/mm/mmap.c
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <koct9i@gmail.com>2014-08-06 19:06:36 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2014-08-06 21:01:19 -0400
commit82f71ae4a2b829a25971bdf54b4d0d3d69d3c8b7 (patch)
tree2b304d094f4468b74a1c581eb9d6f9affa63a146 /mm/mmap.c
parent77142517990fd3d982678c2945ea2c4188ec5f9a (diff)
mm: catch memory commitment underflow
Print a warning (if CONFIG_DEBUG_VM=y) when memory commitment becomes too negative. This shouldn't happen any more - the previous two patches fixed the committed_as underflow issues. [akpm@linux-foundation.org: use VM_WARN_ONCE, per Dave] Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Hugh Dickins <hughd@google.com> Cc: Dave Hansen <dave.hansen@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/mmap.c')
-rw-r--r--mm/mmap.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 129b847d30cc..64c9d736155c 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -31,6 +31,7 @@
31#include <linux/mempolicy.h> 31#include <linux/mempolicy.h>
32#include <linux/rmap.h> 32#include <linux/rmap.h>
33#include <linux/mmu_notifier.h> 33#include <linux/mmu_notifier.h>
34#include <linux/mmdebug.h>
34#include <linux/perf_event.h> 35#include <linux/perf_event.h>
35#include <linux/audit.h> 36#include <linux/audit.h>
36#include <linux/khugepaged.h> 37#include <linux/khugepaged.h>
@@ -134,6 +135,10 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
134{ 135{
135 unsigned long free, allowed, reserve; 136 unsigned long free, allowed, reserve;
136 137
138 VM_WARN_ONCE(percpu_counter_read(&vm_committed_as) <
139 -(s64)vm_committed_as_batch * num_online_cpus(),
140 "memory commitment underflow");
141
137 vm_acct_memory(pages); 142 vm_acct_memory(pages);
138 143
139 /* 144 /*