2022-03-25 05:00:55

by Chris Down

[permalink] [raw]
Subject: Re: [RFC PATCH] cgroup: introduce proportional protection on memcg

I'm confused by the aims of this patch. We already have proportional reclaim
for memory.min and memory.low, and memory.high is already "proportional" by its
nature to drive memory back down behind the configured threshold.

Could you please be more clear about what you're trying to achieve and in what
way the existing proportional reclaim mechanisms are insufficient for you?


2022-03-25 19:43:31

by Zhaoyang Huang

[permalink] [raw]
Subject: Re: [RFC PATCH] cgroup: introduce proportional protection on memcg

On Thu, Mar 24, 2022 at 10:27 PM Chris Down <[email protected]> wrote:
>
> I'm confused by the aims of this patch. We already have proportional reclaim
> for memory.min and memory.low, and memory.high is already "proportional" by its
> nature to drive memory back down behind the configured threshold.
>
> Could you please be more clear about what you're trying to achieve and in what
> way the existing proportional reclaim mechanisms are insufficient for you?
What I am trying to solve is that, the memcg's protection judgment[1]
is based on a set of fixed value on current design, while the real
scan and reclaim number[2] is based on the proportional min/low on the
real memory usage which you mentioned above. Fixed value setting has
some constraints as
1. It is an experienced value based on observation, which could be inaccurate.
2. working load is various from scenarios.
3. fixed value from [1] could be against the dynamic cgroup_size in [2].

shrink_node_memcgs
mem_cgroup_calculate_protection(target_memcg, memcg); \
if (mem_cgroup_below_min(memcg))
\ ===> [1] check if the memcg is protected based on
fixed min/low value
...
/
else if (mem_cgroup_below_low(memcg)) /
...

shrink_lruvec
get_scan_count
\
mem_cgroup_protection
\ ===> [2] calculate the
number of scan size proportionally
scan = lruvec_size - lruvec_size * protection /
(cgroup_size + 1); /

2022-03-25 19:48:18

by Roman Gushchin

[permalink] [raw]
Subject: Re: [RFC PATCH] cgroup: introduce proportional protection on memcg

It seems like what’s being proposed is an ability to express the protection in % of the current usage rather than an absolute number.
It’s an equivalent for something like a memory (reclaim) priority: e.g. a cgroup with 80% protection is _always_ reclaimed less aggressively than one with a 20% protection.

That said, I’m not a fan of this idea.
It might make sense in some reasonable range of usages, but if your workload is simply leaking memory and growing indefinitely, protecting it seems like a bad idea. And the first part can be easily achieved using an userspace tool.

Thanks!

> On Mar 24, 2022, at 7:33 AM, Chris Down <[email protected]> wrote:
>
> I'm confused by the aims of this patch. We already have proportional reclaim for memory.min and memory.low, and memory.high is already "proportional" by its nature to drive memory back down behind the configured threshold.
>
> Could you please be more clear about what you're trying to achieve and in what way the existing proportional reclaim mechanisms are insufficient for you?
>