Skip to content

Commit

Permalink
mm: don't rely on flags coincidence
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Wu Fengguang <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Hugh Dickins authored and torvalds committed Jun 23, 2009
1 parent 788c7df commit d26ed65
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions mm/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit d26ed65

Please sign in to comment.