From 6adc51ef0c1d0084ecff223c34bb8c15e2620f0b Mon Sep 17 00:00:00 2001 From: Benjamin Herrenschmidt Date: Fri, 6 Oct 2006 00:43:53 -0700 Subject: [PATCH] --- yaml --- r: 39038 b: refs/heads/master c: 7f7bbbe50b8a28f4dfaa4cea939ddb50198c4a99 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/include/linux/mm.h | 1 + trunk/mm/memory.c | 9 ++++++--- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/[refs] b/[refs] index 129a108015a6..12a6efb3a0f6 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 1ca4cb2418c04914e4661c059cf5b7b9262c645a +refs/heads/master: 7f7bbbe50b8a28f4dfaa4cea939ddb50198c4a99 diff --git a/trunk/include/linux/mm.h b/trunk/include/linux/mm.h index b7966ab8cb6a..26146623be2f 100644 --- a/trunk/include/linux/mm.h +++ b/trunk/include/linux/mm.h @@ -593,6 +593,7 @@ static inline int page_mapped(struct page *page) */ #define NOPAGE_SIGBUS (NULL) #define NOPAGE_OOM ((struct page *) (-1)) +#define NOPAGE_REFAULT ((struct page *) (-2)) /* Return to userspace, rerun */ /* * Error return values for the *_nopfn functions diff --git a/trunk/mm/memory.c b/trunk/mm/memory.c index 9cf3f341a28a..b5a4aadd961a 100644 --- a/trunk/mm/memory.c +++ b/trunk/mm/memory.c @@ -1086,6 +1086,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, default: BUG(); } + cond_resched(); } if (pages) { pages[i] = page; @@ -2169,11 +2170,13 @@ static int do_no_page(struct mm_struct *mm, struct vm_area_struct *vma, * after the next truncate_count read. */ - /* no page was available -- either SIGBUS or OOM */ - if (new_page == NOPAGE_SIGBUS) + /* no page was available -- either SIGBUS, OOM or REFAULT */ + if (unlikely(new_page == NOPAGE_SIGBUS)) return VM_FAULT_SIGBUS; - if (new_page == NOPAGE_OOM) + else if (unlikely(new_page == NOPAGE_OOM)) return VM_FAULT_OOM; + else if (unlikely(new_page == NOPAGE_REFAULT)) + return VM_FAULT_MINOR; /* * Should we do an early C-O-W break?