lkml.org 
[lkml]   [2021]   [Feb]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2 3/4] mm: Introduce page_needs_cow_for_dma() for deciding whether cow
On Thu, Feb 04, 2021 at 09:54:37AM -0800, Linus Torvalds wrote:
> On Thu, Feb 4, 2021 at 6:50 AM Peter Xu <peterx@redhat.com> wrote:
> >
> > --- a/include/linux/mm.h
> > +++ b/include/linux/mm.h
> > @@ -1291,6 +1291,27 @@ static inline bool page_maybe_dma_pinned(struct page *page)
> > GUP_PIN_COUNTING_BIAS;
> > }
> >
> > +static inline bool is_cow_mapping(vm_flags_t flags)
> > +{
> > + return (flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
> > +}
>
> Oh, and I just realized: moving this to <linux/mm.h> means that this
> patch could/should also get rid of
>
> - manual copy of this in mm/hugetlb.c:
>
> cow = (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
>
> - private #define for the same thing in fs/proc/task_mmu.c
>
> #define is_cow_mapping(flags) (((flags) & (VM_SHARED |
> VM_MAYWRITE)) == VM_MAYWRITE)
>
> - manual copy in drivers/gpu/drm/vmwgfx/vmwgfx_page_dirty.c:
>
> bool is_cow_mapping =
> (vma->vm_flags & (VM_SHARED | VM_MAYWRITE)) == VM_MAYWRITE;
>
> I guess it could be a later cleanup patch too, but maybe best done in
> this series just to not forget about it.

Will do in v3 if there is. Or I'll post a standalone patch to not disturb Gal
just in case he's kicked a test. Thanks,

--
Peter Xu

\
 
 \ /
  Last update: 2021-02-04 20:29    [W:0.103 / U:4.304 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site