Re: [RFC PATCH] cgroup: introduce dynamic protection for memcg
From: Michal Hocko
Date: Thu Apr 07 2022 - 10:15:22 EST
On Thu 07-04-22 20:36:51, Zhaoyang Huang wrote:
> On Thu, Apr 7, 2022 at 5:44 PM Michal Hocko <mhocko@xxxxxxxx> wrote:
> >
> > [...]
> > On Thu 07-04-22 16:59:50, Zhaoyang Huang wrote:
> > > > This means that limits are altered even if there is memory to be
> > > > reclaimed from other memcgs. Why? How does this line up with the
> > > > basic property of the low limit to act as a protection from the reclaim?
> > > ok, partially understand. I would like to say that low's original
> > > definition under this patch has changed, says the calculated low just
> > > provide protection when the psi value is lower than the setting and
> > > will introduce reclaiming if it exceed.
> >
> > OK, I guess I finally get to understand what you are trying to say. So
> > effectivelly your new semantic defines the low limit as an initial
> > protection that is very soft and only preserved under a light global
> > memory pressure[1]. If the reclaim pressure is higher the user provided
> > protection is decreased. The new semantic is planned to be a global
> > opt-in.
> >
> > Correct?
> right. But I don't think the original protection is soft which could
> be proved by the test result that the memcg is protected in a certain
> range of pressure and could also help to release the system by
> breaking low limit.
Low limit protection is considered soft because it doesn't provide any
guarantee. I will be ignored (and that will be reported to the userspace
via LOW event) if there is nothing reclaimable in the scope of the
reclaimed hierarchy. An alternative would be OOM actually.
> > Now, that I (believe) to have a slightly better understanding I have to
> > say I really dislike the idea.
> > First of all the new semantic would have to be memcg reclaim aware. That
> > means that the scaling logic would need to be aware where the memory
> > pressure comes from.
> I don't follow. Does it mean that the protected should distinguish the
> pressure from global and other memcgs? I don't know why.
No, it should behave consistently for any external memory pressure.
A reclaimed memcg can apply different constraint depending on the root
of the reclaim. Your solution is considering root to be root_memcg.
[...]
--
Michal Hocko
SUSE Labs