Commit d26ed650d9947a786bbda8de9cd914dbeebc1a68

Authored by Hugh Dickins
Committed by Linus Torvalds
1 parent 788c7df451

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>

Showing 1 changed file with 4 additions and 2 deletions Side-by-side Diff

... ... @@ -1311,8 +1311,10 @@
1311 1311 while (!(page = follow_page(vma, start, foll_flags))) {
1312 1312 int ret;
1313 1313  
1314   - /* FOLL_WRITE matches FAULT_FLAG_WRITE! */
1315   - ret = handle_mm_fault(mm, vma, start, foll_flags & FOLL_WRITE);
  1314 + ret = handle_mm_fault(mm, vma, start,
  1315 + (foll_flags & FOLL_WRITE) ?
  1316 + FAULT_FLAG_WRITE : 0);
  1317 +
1316 1318 if (ret & VM_FAULT_ERROR) {
1317 1319 if (ret & VM_FAULT_OOM)
1318 1320 return i ? i : -ENOMEM;