提交 82f71ae4 编写于 作者: K Konstantin Khlebnikov 提交者: Linus Torvalds

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: NKonstantin Khlebnikov <koct9i@gmail.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Dave Hansen <dave.hansen@intel.com>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
上级 77142517
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include <linux/mempolicy.h> #include <linux/mempolicy.h>
#include <linux/rmap.h> #include <linux/rmap.h>
#include <linux/mmu_notifier.h> #include <linux/mmu_notifier.h>
#include <linux/mmdebug.h>
#include <linux/perf_event.h> #include <linux/perf_event.h>
#include <linux/audit.h> #include <linux/audit.h>
#include <linux/khugepaged.h> #include <linux/khugepaged.h>
...@@ -134,6 +135,10 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin) ...@@ -134,6 +135,10 @@ int __vm_enough_memory(struct mm_struct *mm, long pages, int cap_sys_admin)
{ {
unsigned long free, allowed, reserve; unsigned long free, allowed, reserve;
VM_WARN_ONCE(percpu_counter_read(&vm_committed_as) <
-(s64)vm_committed_as_batch * num_online_cpus(),
"memory commitment underflow");
vm_acct_memory(pages); vm_acct_memory(pages);
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册