Messages in this thread |  | | From | Linus Torvalds <> | Date | Wed, 23 Sep 2020 13:25:52 -0700 | Subject | Re: [PATCH 4/5] mm: Do early cow for pinned pages during fork() for ptes |
| |
On Tue, Sep 22, 2020 at 6:03 PM Peter Xu <peterx@redhat.com> wrote: > > > If we rely on "copy_ret == COPY_MM_BREAK_COW" we can unify "again" and > > "again_break_cow", we don't need to clear ->cow_new_page, this makes the > > logic more understandable. To me at least ;) > > I see your point. I'll definitely try it out. I think I'll at least use what > you preferred above since it's actually the same as before, logically. Then > I'll consider drop the again_break_cow, as long as I'm still as confident after > I do the change on not leaking anything :).
So the two patches I sent out to re-organize copy_one_pte() were literally meant to make all this mess go away.
IOW, the third patch would be something (COMPLETELY UNTESTED) like the attached.
I think the logic for the preallocation is fairly obvious, but it might be better to allocate a batch of pages for all I know. That said, I can't really make myself care about the performance of a fork() after you've pinned pages in it, so..
Linus [unhandled content-type:application/octet-stream] |  |