On Fri 04-01-19 18:02:19, Fam Zheng wrote: > > > > On Jan 4, 2019, at 17:04, Michal Hocko <mhocko@xxxxxxxxxx> wrote: > > > > This is a natural side effect of shared memory, I am afraid. Isolated > > memory cgroups should limit any shared resources to bare minimum. You > > will get "who touches first gets charged" behavior otherwise and that is > > not really deterministic. > > I don’t quite understand your comment. I think the current behavior > for the ext4_inode_cachep slab family is just “who touches first > gets charged”, and later users of the same file from a different mem > cgroup can benefit from the cache, keep it from being released, but > doesn’t get charged. Yes, this is exactly what I've said. And that leads to non-deterministic behavior because users from other memcgs are keeping charges alive and the isolation really doesn't work properly. Think of it as using memory on behalf of other party that is supposed to be isolated from you. Sure this can work reasonably well if the sharing is not really predominated. -- Michal Hocko SUSE Labs