On 08/21, Peter Xu wrote: > > --- a/mm/gup.c > +++ b/mm/gup.c > @@ -381,22 +381,13 @@ static int follow_pfn_pte(struct vm_area_struct *vma, unsigned long address, > } > > /* > - * FOLL_FORCE or a forced COW break can write even to unwritable pte's, > - * but only after we've gone through a COW cycle and they are dirty. > + * FOLL_FORCE can write to even unwritable pte's, but only > + * after we've gone through a COW cycle and they are dirty. > */ > static inline bool can_follow_write_pte(pte_t pte, unsigned int flags) > { > - return pte_write(pte) || ((flags & FOLL_COW) && pte_dirty(pte)); > -} > - > -/* > - * A (separate) COW fault might break the page the other way and > - * get_user_pages() would return the page from what is now the wrong > - * VM. So we need to force a COW break at GUP time even for reads. > - */ > -static inline bool should_force_cow_break(struct vm_area_struct *vma, unsigned int flags) > -{ > - return is_cow_mapping(vma->vm_flags) && (flags & (FOLL_GET | FOLL_PIN)); > + return pte_write(pte) || > + ((flags & FOLL_FORCE) && (flags & FOLL_COW) && pte_dirty(pte)); Do we really need to add the FOLL_FORCE check back? Afaics, FOLL_COW is only possible if FOLL_FORCE was set. Oleg.