On Fri, Jul 26, 2024 at 10:30 AM Shakeel Butt <shakeel.butt@xxxxxxxxx> wrote: > > On Fri, Jul 26, 2024 at 09:25:27AM GMT, Yosry Ahmed wrote: > > On Fri, Jul 26, 2024 at 8:48 AM Shakeel Butt <shakeel.butt@xxxxxxxxx> wrote: > > > > [...] > > > > > > No, the workloads running in non-root memcgs will not see any > > > difference. Only the workloads running in root will see charging > > > overhead. > > > > 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? We think of the memory charged to the root > > as system overhead, while the memory charged to top-level memcgs > > isn't. > > > > So basically total_memory - root::memory.children_usage would be a > > fast way to get a rough estimation of system overhead. The same would > > not apply for total_memory - root::memory.current if I understand > > correctly. > > Please note that root::memory.children_usage will have top level zombies > included as well (at least until lru reparenting is not done). So, for > your example it would provide good estimation of top level zombie memory > through root::memory.children_usage - top_level(alive)::memory.current. Good point. The fact that it includes the top-level zombies makes it less valuable for this use case, as zombie memory is considered system overhead as well. So we need to iterate the top level memcgs anyway.