Skip to content

Commit 82f71ae

Browse files
koct9itorvalds
authored andcommitted
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>
1 parent 7714251 commit 82f71ae

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

‎mm/mmap.c‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include <linux/mempolicy.h>
3232
#include <linux/rmap.h>
3333
#include <linux/mmu_notifier.h>
34+
#include <linux/mmdebug.h>
3435
#include <linux/perf_event.h>
3536
#include <linux/audit.h>
3637
#include <linux/khugepaged.h>
@@ -134,6 +135,10 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
134135
{
135136
unsigned long free, allowed, reserve;
136137

138+
VM_WARN_ONCE(percpu_counter_read(&vm_committed_as) <
139+
-(s64)vm_committed_as_batch * num_online_cpus(),
140+
"memory commitment underflow");
141+
137142
vm_acct_memory(pages);
138143

139144
/*

0 commit comments

Comments
 (0)