From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755403AbZFDVa6 (ORCPT ); Thu, 4 Jun 2009 17:30:58 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754636AbZFDV2k (ORCPT ); Thu, 4 Jun 2009 17:28:40 -0400 Received: from one.firstfloor.org ([213.235.205.2]:40875 "EHLO one.firstfloor.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754753AbZFDV2j (ORCPT ); Thu, 4 Jun 2009 17:28:39 -0400 From: Andi Kleen References: <200906041128.112757038@firstfloor.org> In-Reply-To: <200906041128.112757038@firstfloor.org> To: akpm@linux-foundation.org, npiggin@suse.de, linux-kernel@vger.kernel.org, linux-mm@kvack.org, fengguang.wu@intel.com Subject: [PATCH] [9/15] HWPOISON: Handle hardware poisoned pages in try_to_unmap Message-Id: <20090604212820.E807A1D028F@basil.firstfloor.org> Date: Thu, 4 Jun 2009 23:28:20 +0200 (CEST) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Also add a new flag to not do that (needed for the memory-failure handler later) Signed-off-by: Andi Kleen --- include/linux/rmap.h | 1 + mm/rmap.c | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) Index: linux/mm/rmap.c =================================================================== --- linux.orig/mm/rmap.c +++ linux/mm/rmap.c @@ -943,7 +943,14 @@ static int try_to_unmap_one(struct page /* Update high watermark before we lower rss */ update_hiwater_rss(mm); - if (PageAnon(page)) { + if (PageHWPoison(page) && !(flags & TTU_IGNORE_HWPOISON)) { + 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_hwpoison_entry(page))); + } else if (PageAnon(page)) { swp_entry_t entry = { .val = page_private(page) }; if (PageSwapCache(page)) { Index: linux/include/linux/rmap.h =================================================================== --- linux.orig/include/linux/rmap.h +++ linux/include/linux/rmap.h @@ -93,6 +93,7 @@ enum ttu_flags { TTU_IGNORE_MLOCK = (1 << 8), /* ignore mlock */ TTU_IGNORE_ACCESS = (1 << 9), /* don't age */ + TTU_IGNORE_HWPOISON = (1 << 10),/* corrupted page is recoverable */ }; #define TTU_ACTION(x) ((x) & TTU_ACTION_MASK)