summaryrefslogtreecommitdiff
path: root/mm/memory-failure.c
diff options
context:
space:
mode:
authorAndi Kleen <andi@firstfloor.org>2009-12-16 14:19:57 +0300
committerAndi Kleen <ak@linux.intel.com>2009-12-16 14:19:57 +0300
commit588f9ce6ca61ecb4663ee6ef2f75d2d96c73151e (patch)
tree4f68c55642c51312bdf6e49818b9889ec37a1ac3 /mm/memory-failure.c
parent7bc98b97ed5dfe710025414de771baa674998892 (diff)
downloadlinux-588f9ce6ca61ecb4663ee6ef2f75d2d96c73151e.tar.xz
HWPOISON: Be more aggressive at freeing non LRU caches
shake_page handles more types of page caches than lru_drain_all() - per cpu page allocator pages - per CPU LRU Stops early when the page became free. Used in followon patches. Signed-off-by: Andi Kleen <ak@linux.intel.com>
Diffstat (limited to 'mm/memory-failure.c')
-rw-r--r--mm/memory-failure.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/mm/memory-failure.c b/mm/memory-failure.c
index 50d4f8d7024a..38fcbb22eab9 100644
--- a/mm/memory-failure.c
+++ b/mm/memory-failure.c
@@ -83,6 +83,28 @@ static int kill_proc_ao(struct task_struct *t, unsigned long addr, int trapno,
}
/*
+ * When a unknown page type is encountered drain as many buffers as possible
+ * in the hope to turn the page into a LRU or free page, which we can handle.
+ */
+void shake_page(struct page *p)
+{
+ if (!PageSlab(p)) {
+ lru_add_drain_all();
+ if (PageLRU(p))
+ return;
+ drain_all_pages();
+ if (PageLRU(p) || is_free_buddy_page(p))
+ return;
+ }
+ /*
+ * Could call shrink_slab here (which would also
+ * shrink other caches). Unfortunately that might
+ * also access the corrupted page, which could be fatal.
+ */
+}
+EXPORT_SYMBOL_GPL(shake_page);
+
+/*
* Kill all processes that have a poisoned page mapped and then isolate
* the page.
*