On Fri, Jul 26, 2024 at 09:50:49AM GMT, T.J. Mercier wrote: > On Fri, Jul 26, 2024 at 9:26 AM Yosry Ahmed <yosryahmed@xxxxxxxxxx> wrote: > > [...] > > > > Oh yeah we already charge the root's page counters hierarchically in > > the upstream kernel, we just do not charge them if the origin of the > > charge is the root itself. > > > > We also have workloads that iterate top-level memcgs to calculate the > > total charged memory, so memory.children_usage for the root memcg > > would help. > > > > As for memory.current, do you have any data about how much memory is > > charged to the root itself? > > Yeah I wonder if we'd be able to see any significant regressions for > stuff that lives there today if we were to start charging it. I can > try running a test with Android next week. I guess try_charge() is the > main thing that would need to change to allow root charges? > It would a bit more involved like allocating objcg for the root and changing memcg_slab_post_alloc_hook() to use root memcg if account flags are not present. There might some changes needed for list_lru and reclaim but I have not looked deeper into it yet.