[PATCH] [11/16] POISON: Handle poisoned pages in try_to_unmap

Andi Kleen
2009-04-07T15:23:15Z

When a page has the poison bit set replace the PTE with a poison entry.
This causes the right error handling to be done later when a process runs
into it.

Cc: Lee.Schermerhorn@hp.com
Signed-off-by: Andi Kleen <ak@linux.intel.com>

---
mm/rmap.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)

Index: linux/mm/rmap.c
===================================================================
--- linux.orig/mm/rmap.c 2009-04-07 16:39:39.000000000 +0200
+++ linux/mm/rmap.c 2009-04-07 16:39:39.000000000 +0200
@@ -801,7 +801,14 @@
/* Update high watermark before we lower rss */
update_hiwater_rss(mm);

- if (PageAnon(page)) {
+ if (PagePoison(page)) {
+ if (PageAnon(page))
+ dec_mm_counter(mm, anon_rss);
+ else if (!is_migration_entry(pte_to_swp_entry(*pte)))
+ dec_mm_counter(mm, file_rss);
+ set_pte_at(mm, address, pte,
+ swp_entry_to_pte(make_poison_entry(page)));
+ } else if (PageAnon(page)) {
swp_entry_t entry = { .val = page_private(page) };

if (PageSwapCache(page)) {