On Tue, Feb 21, 2023 at 09:45:15AM -1000, Tejun Heo wrote: > > Multiple cgroup can pin the same page, so it is not as simple as just > > transfering ownership, we need multi-ownership and to really fix the > > memcg limitations with MAP_SHARED without an API impact. > > > > You are right that pinning is really just a special case of > > allocation, but there is a reason the memcg was left with weak support > > for MAP_SHARED and changing that may be more than just hard but an > > infeasible trade off.. > > > > At least I don't have a good idea how to even approach building a > > reasonable datstructure that can track the number of > > charges per-cgroup per page. :\ > > As I wrote above, I don't think the problem here is the case of pages being > shared by multiple cgroups concurrently. We can leave that problem for > another thread. However, if we want to support accounting and control of > pinned memory, we really shouldn't introduce a fundmental discrepancy like > the owner and pinner disagreeing with each other. At least conceptually, the > solution is rather straight-forward - whoever pins a page should also claim > the ownership of it. Ah, sorry, I missed the part about multiple cgroups pinning the same page. Yeah, I can't think of a good answer for that. Thanks. -- tejun