diff options
Diffstat (limited to 'include/linux/mm.h')
-rw-r--r-- | include/linux/mm.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h index a2718e1ed585..6bef67d74adf 100644 --- a/include/linux/mm.h +++ b/include/linux/mm.h | |||
@@ -430,6 +430,19 @@ static inline void set_compound_order(struct page *page, unsigned long order) | |||
430 | } | 430 | } |
431 | 431 | ||
432 | /* | 432 | /* |
433 | * Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when | ||
434 | * servicing faults for write access. In the normal case, do always want | ||
435 | * pte_mkwrite. But get_user_pages can cause write faults for mappings | ||
436 | * that do not have writing enabled, when used by access_process_vm. | ||
437 | */ | ||
438 | static inline pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma) | ||
439 | { | ||
440 | if (likely(vma->vm_flags & VM_WRITE)) | ||
441 | pte = pte_mkwrite(pte); | ||
442 | return pte; | ||
443 | } | ||
444 | |||
445 | /* | ||
433 | * Multiple processes may "see" the same page. E.g. for untouched | 446 | * Multiple processes may "see" the same page. E.g. for untouched |
434 | * mappings of /dev/null, all processes see the same page full of | 447 | * mappings of /dev/null, all processes see the same page full of |
435 | * zeroes, and text pages of executables and shared libraries have | 448 | * zeroes, and text pages of executables and shared libraries have |