summaryrefslogtreecommitdiff
path: root/mm
diff options
context:
space:
mode:
authorKonstantin Khlebnikov <koct9i@gmail.com>2014-07-17 10:57:58 +1000
committerStephen Rothwell <sfr@canb.auug.org.au>2014-07-17 10:57:58 +1000
commit658f6f6e71be87cf1d27c225b85fef4801795a0b (patch)
tree0b8bbc413c4e857f7141c9a009791defd1d18b14 /mm
parent20fd32305a4fc939415da8723af42c40750275eb (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. Signed-off-by: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Hugh Dickins <hughd@google.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/mmap.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mm/mmap.c b/mm/mmap.c
index 129b847d30cc..d3decd9cec8c 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -134,6 +134,12 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
{
unsigned long free, allowed, reserve;
+#ifdef CONFIG_DEBUG_VM
+ WARN_ONCE(percpu_counter_read(&vm_committed_as) <
+ -(s64)vm_committed_as_batch * num_online_cpus(),
+ "memory commitment underflow");
+#endif
+
vm_acct_memory(pages);
/*