Re: [PATCH v3 4/5] mm: memcg: charge memcg percpu memory to the parent cgroup

From: Michal Koutný
Date: Wed Aug 12 2020 - 12:29:02 EST


On Tue, Aug 11, 2020 at 12:32:28PM -0700, Roman Gushchin <guro@xxxxxx> wrote:
> If we'll limit init.slice (where systemd seems to reside), as you suggest,
> we'll eventually create trashing in init.slice, followed by OOM.
> I struggle to see how it makes the life of a user better?
> [...]
> The problem is that OOM-killing the accompanying manager won't release
> resources and help to get rid of accumulated cgroups.
I see your point now. I focused on the creator because of the live
memcgs.

When the issue are the dying memcgs (c), they were effectively released
by their creator but are pinned by whatever remained after their life
(LRU pages, slab->obj_cgroups). Since these pins were created _from
within_ such a child (c), they're most readily removable by reclaiming
(hierarchically) close to c. (It'd be achievable by limiting the lowest
common ancestor of manager and its product (typically root) but that is
more clumsy and less effective.)

This is the reasoning that justifies the remote charge.

Thanks!
Michal

Attachment: signature.asc
Description: Digital signature