Re: [PATCH v2 2/3] mm: Force update of mem cgroup soft limit tree on usage excess

From: Tim Chen
Date: Mon Feb 22 2021 - 14:50:46 EST




On 2/22/21 11:09 AM, Michal Hocko wrote:

>>
>> I actually have tried adjusting the threshold but found that it doesn't work well for
>> the case with unenven memory access frequency between cgroups. The soft
>> limit for the low memory event cgroup could creep up quite a lot, exceeding
>> the soft limit by hundreds of MB, even
>> if I drop the SOFTLIMIT_EVENTS_TARGET from 1024 to something like 8.
>
> What was the underlying reason? Higher order allocations?
>

Not high order allocation.

The reason was because the run away memcg asks for memory much less often, compared
to the other memcgs in the system. So it escapes the sampling update and
was not put onto the tree and exceeds the soft limit
pretty badly. Even if it was put onto the tree and gets page reclaimed below the
limit, it could escape the sampling the next time it exceeds the soft limit.

As long as we are doing sampling update, this problem is baked in unless we
add the check to make sure that the memcg is subjected to page reclaim as long
as it exceeds the soft limit.

Tim