/* Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when servicing faults for write access. In the normal case, do always want pte_mkwrite. But get_user_pages can cause write faults for mappings that do not have writing enabled, when used by access_process_vm.  */
static pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
/* Do pte_mkwrite, but only if the vma says VM_WRITE. We do this when servicing faults for write access. In the normal case, do always want pte_mkwrite. But get_user_pages can cause write faults for mappings that do not have writing enabled, when used by access_process_vm.  */
static pte_t maybe_mkwrite(pte_t pte, struct vm_area_struct *vma)
{
	if (likely(vma->vm_flags & VM_WRITE))
		pte = pte_mkwrite(pte);
	return pte;
}