提交 588f9ce6 编写于 作者: A Andi Kleen 提交者: Andi Kleen

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: NAndi Kleen <ak@linux.intel.com>
上级 7bc98b97
...@@ -1335,6 +1335,7 @@ extern void memory_failure(unsigned long pfn, int trapno); ...@@ -1335,6 +1335,7 @@ extern void memory_failure(unsigned long pfn, int trapno);
extern int __memory_failure(unsigned long pfn, int trapno, int ref); extern int __memory_failure(unsigned long pfn, int trapno, int ref);
extern int sysctl_memory_failure_early_kill; extern int sysctl_memory_failure_early_kill;
extern int sysctl_memory_failure_recovery; extern int sysctl_memory_failure_recovery;
extern void shake_page(struct page *p);
extern atomic_long_t mce_bad_pages; extern atomic_long_t mce_bad_pages;
#endif /* __KERNEL__ */ #endif /* __KERNEL__ */
......
...@@ -82,6 +82,28 @@ static int kill_proc_ao(struct task_struct *t, unsigned long addr, int trapno, ...@@ -82,6 +82,28 @@ static int kill_proc_ao(struct task_struct *t, unsigned long addr, int trapno,
return ret; return ret;
} }
/*
* 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 * Kill all processes that have a poisoned page mapped and then isolate
* the page. * the page.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册