Re: [PATCH v2 3/4] mm: Do early cow for pinned pages during fork() for ptes

2020-09-26 Thread Linus Torvalds
On Sat, Sep 26, 2020 at 4:23 PM Jason Gunthorpe wrote: > > Linus's version doesn't do pte_sw_mkyoung(), but looks OK to have it I don't think it matters. But I don't think it should make it young, since there's no access, but it's not like it's a big deal. > > + pte

Re: [PATCH v2 3/4] mm: Do early cow for pinned pages during fork() for ptes

2020-09-26 Thread Jason Gunthorpe
On Fri, Sep 25, 2020 at 06:25:59PM -0400, Peter Xu wrote: > -static inline void > +/* > + * Copy one pte. Returns 0 if succeeded, or -EAGAIN if one preallocated page > + * is required to copy this pte. > + */ > +static inline int > copy_present_pte(struct mm_struct *dst_mm, struct mm_struct

[PATCH v2 3/4] mm: Do early cow for pinned pages during fork() for ptes

2020-09-25 Thread Peter Xu
It allows copy_pte_range() to do early cow if the pages were pinned on the source mm. Currently we don't have an accurate way to know whether a page is pinned or not. The only thing we have is page_maybe_dma_pinned(). However that's good enough for now. Especially, with the newly added