summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins <hugh.dickins@tiscali.co.uk>2009-06-23 14:52:49 +0200
committerLinus Torvalds <torvalds@linux-foundation.org>2009-06-23 20:23:33 +0200
commitd26ed650d9947a786bbda8de9cd914dbeebc1a68 (patch)
tree4d3b9577187b2adca6c48861266842dd4f9e7290
parenthugetlb: fault flags instead of write_access (diff)
downloadlinux-d26ed650d9947a786bbda8de9cd914dbeebc1a68.tar.xz
linux-d26ed650d9947a786bbda8de9cd914dbeebc1a68.zip
mm: don't rely on flags coincidence
Indeed FOLL_WRITE matches FAULT_FLAG_WRITE, matches GUP_FLAGS_WRITE, and it's tempting to devise a set of Grand Unified Paging flags; but not today. So until then, let's rely upon the compiler to spot the coincidence, "rather than have that subtle dependency and a comment for it" - as you remarked in another context yesterday. Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk> Acked-by: Wu Fengguang <fengguang.wu@intel.com> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--mm/memory.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/mm/memory.c b/mm/memory.c
index 98bcb90d5957..50da9511aa77 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1311,8 +1311,10 @@ int __get_user_pages(struct task_struct *tsk, struct mm_struct *mm,
while (!(page = follow_page(vma, start, foll_flags))) {
int ret;
- /* FOLL_WRITE matches FAULT_FLAG_WRITE! */
- ret = handle_mm_fault(mm, vma, start, foll_flags & FOLL_WRITE);
+ ret = handle_mm_fault(mm, vma, start,
+ (foll_flags & FOLL_WRITE) ?
+ FAULT_FLAG_WRITE : 0);
+
if (ret & VM_FAULT_ERROR) {
if (ret & VM_FAULT_OOM)
return i ? i : -ENOMEM;