On Fri, Feb 03, 2023 at 09:58:56AM +0100, Michal Hocko wrote: [...] > > > > One advantage I can see is if someone is looking for usage for all top > > containers (alive or zombie) but I wanted to know if that was the real > > motivation behind the patch. > > Isn't that just a global stats that we already display via /proc files? > Things are a bit complicated for kernel memory. Let's take a simple example where there are no processes in the root memcg. In this case the user memory stats should be similar to the global stats under /proc because we always charge user memory. However the kernel memory has to be opted-in to be accounted. So, we have a lot of allocations which are in the global stats but not in the memcg stats. We can traverse the top level memcgs to get kernel stats and subtract it from the global stats which will give the sum of zombie kernel memory and unaccounted kernel memory. For debugging and history/analysis purpose, differentiating between zombie and unaccounted makes sense.