Skip to content

Commit

Permalink
[PATCH] Add NOPFN_REFAULT result from vm_ops->nopfn()
Browse files Browse the repository at this point in the history
Add a NOPFN_REFAULT return code for vm_ops->nopfn() equivalent to
NOPAGE_REFAULT for vmops->nopage() indicating that the handler requests a
re-execution of the faulting instruction

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Arnd Bergmann <arnd.bergmann@de.ibm.com>
Cc: Hugh Dickins <hugh@veritas.com>
Cc: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
  • Loading branch information
Benjamin Herrenschmidt authored and Linus Torvalds committed Feb 12, 2007
1 parent e0dc0d8 commit 22cd25e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions include/linux/mm.h
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,7 @@ static inline int page_mapped(struct page *page)
*/
#define NOPFN_SIGBUS ((unsigned long) -1)
#define NOPFN_OOM ((unsigned long) -2)
#define NOPFN_REFAULT ((unsigned long) -3)

/*
* Different kinds of faults, as returned by handle_mm_fault().
Expand Down
6 changes: 4 additions & 2 deletions mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -2355,10 +2355,12 @@ static noinline int do_no_pfn(struct mm_struct *mm, struct vm_area_struct *vma,
BUG_ON(is_cow_mapping(vma->vm_flags));

pfn = vma->vm_ops->nopfn(vma, address & PAGE_MASK);
if (pfn == NOPFN_OOM)
if (unlikely(pfn == NOPFN_OOM))
return VM_FAULT_OOM;
if (pfn == NOPFN_SIGBUS)
else if (unlikely(pfn == NOPFN_SIGBUS))
return VM_FAULT_SIGBUS;
else if (unlikely(pfn == NOPFN_REFAULT))
return VM_FAULT_MINOR;

page_table = pte_offset_map_lock(mm, pmd, address, &ptl);

Expand Down

0 comments on commit 22cd25e

Please sign in to comment.