On Thu, Dec 21, 2023 at 7:45 PM Henry Huang <henry.hj@xxxxxxxxxxxx> wrote: > > Thanks for replyting. > > On Fri, Dec 22, 2023 at 07:16 AM Yuanchu Xie wrote: > > How does the shared memory get charged to the cgroups? > > Does it all go to cgroup A or B exclusively, or do some pages get > > charged to each one? > > Some pages get charged to cgroup A, and the other get charged to cgroup B. Just a side note: We can potentially "fix" this, but it doesn't mean this is a good practice. In fact, I think this is an anti-pattern to memcgs: resources should be preferably isolated between memcgs, or if a resource has to be shared between memcgs, it should be charged in a predetermined way, not randomly to one of the memcgs sharing it.