Hello Muchun. On Mon, May 30, 2022 at 03:49:17PM +0800, Muchun Song <songmuchun@xxxxxxxxxxxxx> wrote: > +static inline bool obj_cgroup_is_root(struct obj_cgroup *objcg) > +{ > + return objcg == root_obj_cgroup; > +} Admittedly, this predicate alone caught my eye, why it did not also check root_mem_cgroup->objcg_list. However, deeper look reveals it's purpose is to avoid missing uncharges of pages that were charged in non-root memcg and later re-associated upwards after reparenting. So it's like obj_cgroup_root_origin() (I'm not suggesting a rename, just illustrating the understanding). get_obj_cgroup_from_current() gains some complexity but it still holds that in root memcg neither kernel objects nor LRU pages are charged. At the same time, reparented kernel objects or LRU pages are properly uncharged. These parts are Reviewed-by: Michal Koutný <mkoutny@xxxxxxxx> (I did not look into the locking guarantees with the new API though.)