Re: [RFC PATCH] cgroup: introduce dynamic protection for memcg

From: Zhaoyang Huang
Date: Wed Apr 06 2022 - 07:31:25 EST


On Tue, Apr 5, 2022 at 8:08 PM Michal Hocko <mhocko@xxxxxxxx> wrote:
>
> On Mon 04-04-22 21:14:40, Zhaoyang Huang wrote:
> [...]
> > Please be noticed that this patch DOES protect the memcg when external
> > pressure is 1GB as fixed low does.
>
> This is getting more and more confusing (at least to me). Could you
> describe the behavior of the reclaim for the following setups/situations?
>
> a) mostly reclaiming a clean page cache - via kswapd
> b) same as above but the direct reclaim is necessary but very
> lightweight
> c) direct reclaim makes fwd progress but not enough to satisfy the
> allocation request (so the reclaim has to be retried)
> d) direct reclaim not making progress and low limit protection is
> ignored.
>
> Say we have several memcgs and only some have low memory protection
> configured. What is the user observable state of the protected group and
> when and how much the protection can be updated?
Ok. I guess you doubt why the external reclaiming on global LRU or
other unprotected memcg does not satisfy the requirement and have the
protected memcg have to face reclaim? According to my experience, this
is common for a large number of malloc from userspace OR high order
alloc_pages within the kernel. I have retested the previous case by
removing mlock and get the trend of result is same, where the pages on
global LRU could help to push some of the global memory pressure back
to global LRU and finally reach the protected memcg.
>
> I think it would be also helpful to describe the high level semantic of
> this feature.
>
> > Besides, how does the admin decide
> > the exact number of low/min if it expand from small to even xGB in a
> > quick changing scenario?
>
> This is not really related, is it? There are different ways to tune for
> the protection.
>
> [...]
> --
> Michal Hocko
> SUSE Labs