On Mon, Mar 20, 2023 at 03:06:47AM +0000, Cai Xinchen wrote: > There are two problems left: > > root > / \ > A B > / \ \ > C E D > > 1. In some case of reparent, some page cache may be used by other memcg > D but it charges to the parent memcg A of dying memcg E. D is getting > away with using the page for free while A is taxed. Note that A is (effectively) taxed even before E is removed due to hierarchical nature of charging. Then what you describe transforms into "well-known" problem of shared charging (with not well-known solution :-/). HTH, Michal