]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
mm: catch memory commitment underflow
authorKonstantin Khlebnikov <koct9i@gmail.com>
Thu, 26 Jun 2014 00:42:43 +0000 (10:42 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Thu, 26 Jun 2014 00:42:43 +0000 (10:42 +1000)
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>
mm/mmap.c

index 129b847d30cc35c8724cee63e924f69faaf542c6..d3decd9cec8c04534242db830310a9b70e233135 100644 (file)
--- 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);
 
        /*