92 lines
2.8 KiB
Diff
92 lines
2.8 KiB
Diff
From git-commits-head-owner@vger.kernel.org Tue Sep 26 20:23:25 2006
|
|
Date: Tue, 26 Sep 2006 15:59:54 GMT
|
|
Message-Id: <200609261559.k8QFxs8b003237@hera.kernel.org>
|
|
From: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
|
|
To: git-commits-head@vger.kernel.org
|
|
Subject: [PATCH] mm: balance dirty pages
|
|
|
|
commit edc79b2a46ed854595e40edcf3f8b37f9f14aa3f
|
|
tree c1120bebede9660ab00f9439aa7a84ab9434ac38
|
|
parent d08b3851da41d0ee60851f2c75b118e1f7a5fc89
|
|
author Peter Zijlstra <a.p.zijlstra@chello.nl> 1159252258 -0700
|
|
committer Linus Torvalds <torvalds@g5.osdl.org> 1159285724 -0700
|
|
|
|
[PATCH] mm: balance dirty pages
|
|
|
|
Now that we can detect writers of shared mappings, throttle them. Avoids OOM
|
|
by surprise.
|
|
|
|
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
|
|
Cc: Hugh Dickins <hugh@veritas.com>
|
|
Signed-off-by: Andrew Morton <akpm@osdl.org>
|
|
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
|
|
|
|
include/linux/writeback.h | 1 +
|
|
mm/memory.c | 5 +++--
|
|
mm/page-writeback.c | 10 ++++++++++
|
|
3 files changed, 14 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/include/linux/writeback.h b/include/linux/writeback.h
|
|
index 0422036..56a23a0 100644
|
|
--- a/include/linux/writeback.h
|
|
+++ b/include/linux/writeback.h
|
|
@@ -116,6 +116,7 @@ int sync_page_range(struct inode *inode,
|
|
loff_t pos, loff_t count);
|
|
int sync_page_range_nolock(struct inode *inode, struct address_space *mapping,
|
|
loff_t pos, loff_t count);
|
|
+void set_page_dirty_balance(struct page *page);
|
|
|
|
/* pdflush.c */
|
|
extern int nr_pdflush_threads; /* Global so it can be exported to sysctl
|
|
diff --git a/mm/memory.c b/mm/memory.c
|
|
index fa941b1..dd7d7fc 100644
|
|
--- a/mm/memory.c
|
|
+++ b/mm/memory.c
|
|
@@ -49,6 +49,7 @@ #include <linux/rmap.h>
|
|
#include <linux/module.h>
|
|
#include <linux/delayacct.h>
|
|
#include <linux/init.h>
|
|
+#include <linux/writeback.h>
|
|
|
|
#include <asm/pgalloc.h>
|
|
#include <asm/uaccess.h>
|
|
@@ -1571,7 +1572,7 @@ gotten:
|
|
unlock:
|
|
pte_unmap_unlock(page_table, ptl);
|
|
if (dirty_page) {
|
|
- set_page_dirty(dirty_page);
|
|
+ set_page_dirty_balance(dirty_page);
|
|
put_page(dirty_page);
|
|
}
|
|
return ret;
|
|
@@ -2218,7 +2219,7 @@ retry:
|
|
unlock:
|
|
pte_unmap_unlock(page_table, ptl);
|
|
if (dirty_page) {
|
|
- set_page_dirty(dirty_page);
|
|
+ set_page_dirty_balance(dirty_page);
|
|
put_page(dirty_page);
|
|
}
|
|
return ret;
|
|
diff --git a/mm/page-writeback.c b/mm/page-writeback.c
|
|
index 1c87430..b9f4c6f 100644
|
|
--- a/mm/page-writeback.c
|
|
+++ b/mm/page-writeback.c
|
|
@@ -244,6 +244,16 @@ static void balance_dirty_pages(struct a
|
|
pdflush_operation(background_writeout, 0);
|
|
}
|
|
|
|
+void set_page_dirty_balance(struct page *page)
|
|
+{
|
|
+ if (set_page_dirty(page)) {
|
|
+ struct address_space *mapping = page_mapping(page);
|
|
+
|
|
+ if (mapping)
|
|
+ balance_dirty_pages_ratelimited(mapping);
|
|
+ }
|
|
+}
|
|
+
|
|
/**
|
|
* balance_dirty_pages_ratelimited_nr - balance dirty memory state
|
|
* @mapping: address_space which was dirtied
|