diff options
-rw-r--r-- | include/linux/mm.h | 1 | ||||
-rw-r--r-- | mm/memory.c | 9 |
2 files changed, 7 insertions, 3 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index b7966ab8cb6a..26146623be2f 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -593,6 +593,7 @@ static inline int page_mapped(struct page *page) | |||
593 | */ | 593 | */ |
594 | #define NOPAGE_SIGBUS (NULL) | 594 | #define NOPAGE_SIGBUS (NULL) |
595 | #define NOPAGE_OOM ((struct page *) (-1)) | 595 | #define NOPAGE_OOM ((struct page *) (-1)) |
596 | #define NOPAGE_REFAULT ((struct page *) (-2)) /* Return to userspace, rerun */ | ||
596 | 597 | ||
597 | /* | 598 | /* |
598 | * Error return values for the *_nopfn functions | 599 | * Error return values for the *_nopfn functions |
diff --git a/mm/memory.c b/mm/memory.c index 9cf3f341a28a..b5a4aadd961a 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -1086,6 +1086,7 @@ int get_user_pages(struct task_struct *tsk, struct mm_struct *mm, | |||
1086 | default: | 1086 | default: |
1087 | BUG(); | 1087 | BUG(); |
1088 | } | 1088 | } |
1089 | cond_resched(); | ||
1089 | } | 1090 | } |
1090 | if (pages) { | 1091 | if (pages) { |
1091 | pages[i] = page; | 1092 | pages[i] = page; |
@@ -2169,11 +2170,13 @@ retry: | |||
2169 | * after the next truncate_count read. | 2170 | * after the next truncate_count read. |
2170 | */ | 2171 | */ |
2171 | 2172 | ||
2172 | /* no page was available -- either SIGBUS or OOM */ | 2173 | /* no page was available -- either SIGBUS, OOM or REFAULT */ |
2173 | if (new_page == NOPAGE_SIGBUS) | 2174 | if (unlikely(new_page == NOPAGE_SIGBUS)) |
2174 | return VM_FAULT_SIGBUS; | 2175 | return VM_FAULT_SIGBUS; |
2175 | if (new_page == NOPAGE_OOM) | 2176 | else if (unlikely(new_page == NOPAGE_OOM)) |
2176 | return VM_FAULT_OOM; | 2177 | return VM_FAULT_OOM; |
2178 | else if (unlikely(new_page == NOPAGE_REFAULT)) | ||
2179 | return VM_FAULT_MINOR; | ||
2177 | 2180 | ||
2178 | /* | 2181 | /* |
2179 | * Should we do an early C-O-W break? | 2182 | * Should we do an early C-O-W break? |