On Mon, Sep 21, 2020 at 04:57:38PM +0200, Michal Hocko wrote: > Switching the order wouldn't make much of a difference right. At least > not for memcg where all the accounted allocations will still go to > current's memcg. I think I'll make it simple to charge the parent directly just like what we do right now. I do expect that the charged amount could be quite some when there're a lot pinned pages on the parent process, however hopefully it's acceptable as it's still a very rare case, and proper MADV_DONTFORK upon pinned pages on the parent process will eliminate all these charges too. I actually already prepared some patches. It's definitely bigger than expected due to the complexity that we held page table locks in copy_one_pte() when trying to break the cow pages. I don't know whether it would be proper any more for rc, especially the ending of rcs. Anyway I'll post them out soon after I did some basic tests, because I think that's something right to do irrelevant to when it will be merged. Thanks, -- Peter Xu