lkml.org 
[lkml]   [2009]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] [7/16] POISON: Add basic support for poisoned pages in fault handler
    Andi Kleen wrote:

    > - Add a new VM_FAULT_POISON error code to handle_mm_fault. Right now
    > architectures have to explicitely enable poison page support, so
    > this is forward compatible to all architectures. They only need
    > to add it when they enable poison page support.
    > - Add poison page handling in swap in fault code
    >
    > Signed-off-by: Andi Kleen <ak@linux.intel.com>
    >
    > ---
    > include/linux/mm.h | 3 ++-
    > mm/memory.c | 17 ++++++++++++++---
    > 2 files changed, 16 insertions(+), 4 deletions(-)
    >
    > Index: linux/mm/memory.c
    > ===================================================================
    > --- linux.orig/mm/memory.c 2009-04-07 16:39:24.000000000 +0200
    > +++ linux/mm/memory.c 2009-04-07 16:43:06.000000000 +0200
    > @@ -1315,7 +1315,8 @@
    > if (ret & VM_FAULT_ERROR) {
    > if (ret & VM_FAULT_OOM)
    > return i ? i : -ENOMEM;
    > - else if (ret & VM_FAULT_SIGBUS)
    > + if (ret &
    > + (VM_FAULT_POISON|VM_FAULT_SIGBUS))
    > return i ? i : -EFAULT;
    > BUG();
    > }
    > @@ -2426,8 +2427,15 @@
    > goto out;
    >
    > entry = pte_to_swp_entry(orig_pte);
    > - if (is_migration_entry(entry)) {
    > - migration_entry_wait(mm, pmd, address);
    > + if (unlikely(non_swap_entry(entry))) {
    > + if (is_migration_entry(entry)) {
    > + migration_entry_wait(mm, pmd, address);
    > + } else if (is_poison_entry(entry)) {
    > + ret = VM_FAULT_POISON;
    > + } else {
    > + print_bad_pte(vma, address, pte, NULL);
    > + ret = VM_FAULT_OOM;
    > + }
    > goto out;
    > }
    > delayacct_set_flag(DELAYACCT_PF_SWAPIN);
    > @@ -2451,6 +2459,9 @@
    > /* Had to read the page from swap area: Major fault */
    > ret = VM_FAULT_MAJOR;
    > count_vm_event(PGMAJFAULT);
    > + } else if (PagePoison(page)) {
    > + ret = VM_FAULT_POISON;

    delayacct_clear_flag(DELAYACCT_PF_SWAPIN) would be needed here.

    > + goto out;
    > }
    >
    > lock_page(page);

    Regards,
    --
    Hidehiro Kawai
    Hitachi, Systems Development Laboratory
    Linux Technology Center



    \
     
     \ /
      Last update: 2009-05-26 15:01    [W:4.351 / U:0.468 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site