Re: [PATCH] mm, memcg: Add a memcg_slabinfo debugfs file

From: Waiman Long
Date: Wed Jun 19 2019 - 11:52:55 EST


On 6/19/19 11:35 AM, Shakeel Butt wrote:
> On Wed, Jun 19, 2019 at 8:30 AM Waiman Long <longman@xxxxxxxxxx> wrote:
>> On 6/19/19 11:18 AM, Shakeel Butt wrote:
>>> On Wed, Jun 19, 2019 at 7:46 AM Waiman Long <longman@xxxxxxxxxx> wrote:
>>>> There are concerns about memory leaks from extensive use of memory
>>>> cgroups as each memory cgroup creates its own set of kmem caches. There
>>>> is a possiblity that the memcg kmem caches may remain even after the
>>>> memory cgroup removal. Therefore, it will be useful to show how many
>>>> memcg caches are present for each of the kmem caches.
>>>>
>>>> This patch introduces a new <debugfs>/memcg_slabinfo file which is
>>>> somewhat similar to /proc/slabinfo in format, but lists only slabs that
>>>> are in memcg kmem caches. Information available in /proc/slabinfo are
>>>> not repeated in memcg_slabinfo.
>>>>
>>> At Google, we have an interface /proc/slabinfo_full which shows each
>>> kmem cache (root and memcg) on a separate line i.e. no accumulation.
>>> This interface has helped us a lot for debugging zombies and memory
>>> leaks. The name of the memcg kmem caches include the memcg name, css
>>> id and "dead" for offlined memcgs. I think these extra information is
>>> much more useful for debugging. What do you think?
>>>
>>> Shakeel
>> Yes, I think that can be a good idea. My only concern is that it can be
>> very verbose. Will work on a v2 patch.
>>
> Yes, it is very verbose but it is only for debugging and normal users
> should not be (continuously) reading that interface.

I am not against it. It is just an observation. I still think we can
skip kmem caches that don't have any child memcg caches as the
information is in slabinfo already.

Cheers,
Longman