Re: PROBLEM: cgroup cost too much memory when transfer small files to tmpfs

Michal Hocko
2020-07-24T07:55:12Z

On Tue 21-07-20 11:19:52, jingrui wrote:
[...]
> systemd related issue: https://github.com/systemd/systemd/issues/16499

Well, I would be really careful with one-off and short lived cgroups.
Firstly there are charges which cannot be easily reparented and secondly
even if the memory footprint is reduced there would be still memcgs
standing in the way.

[...]
> 1. Do we have any idea to descrease cgroup memory cost in this case?

Others have already commented on this.

> 2. When user remove cgroup directory, does it possible associated file memory to root cgroup?

We used to do that in the past but removed it by b2052564e66d ("mm:
memcontrol: continue cache reclaim from offlined groups"). Please read
through the changelog for the reasoning behind.

> 3. Can we provide an option that do not associate memory with cgroup in tmpfs?

What is the reason to run under !root cgroup in those sessions if you do
not care about accounting anyway? tmpfs is a persistent charge until the
file is removed. So if those outlive the session then you either want
them to be charged to somebody or you do not care about accounting at
all, no? Or could you explain your usecase some more?
--
Michal Hocko
SUSE Labs