Re: [PATCH] mm: vmscan: memcg: Add global shrink priority

From: Chris Down
Date: Wed Dec 18 2019 - 09:09:57 EST


Hi Hui,

In general cgroup v1 is in maintenance mode -- that is, excepting specific bugfixes, we don't plan to add new features.

Hui Zhu writes:
Currently, memcg has some config to limit memory usage and config
the shrink behavior.
In the memory-constrained environment, put different priority tasks
into different cgroups with different memory limits to protect the
performance of the high priority tasks. Because the global memory
shrink will affect the performance of all tasks. The memory limit
cgroup can make shrink happen inside the cgroup. Then it can decrease
the memory shrink of the high priority task to protect its performance.

But the memory footprint of the task is not static. It will change as
the working pressure changes. And the version changes will affect it too.
Then set the appropriate memory limit to decrease the global memory shrink
is a difficult job and lead to wasted memory or performance loss sometimes.

This commit adds global shrink priority to memcg to try to handle this
problem.

I have significant concerns with exposing scan priority to userspace. This is an incredibly difficult metric for users to reason about since it's a reclaim implementation feature and would add to an already confusing and fragmented API in v1.

Have you considered using memory protection (memory.low, memory.min) for this instead? It sounds like it can achieve the results you want, in that it allows you to direct and prioritise reclaim in a way that allows for ballparking (ie. it is compatible with applications with variable memory footprints).

Thanks,

Chris