mm: memcg: add priority for soft limit reclaiming
Subsystems (2)
RFC 1/1 mm: memcg: add priority for soft limit reclaiming
Currently memory controler is playing increasingly important role in how memory is used and how pages are reclaimed on memory pressure.
In daily works memcg is often created for critical tasks and their pre configured memory usage is supposed to be met even on memory pressure. Administrator wants to make it configurable that the pages consumed by memcg-B can be reclaimed by page allocations invoked not by memcg-A but by memcg-C.
That configurability is addressed by adding priority for soft limit reclaiming to make sure that no pages will be reclaimed from memcg of higer priortiy in favor of memcg of lower priority.
Pages are reclaimed with no priority being taken into account by default unless user turns it on, and then they are responsible for their smart activities almost the same way as they play realtime FIFO/RR games.
Priority is available only in the direct reclaiming context in order to advoid churning in the complex kswapd behavior.
---
include/linux/memcontrol.h +15 -0
@@ -230,6 +230,21 @@ struct mem_cgroup {int under_oom;int swappiness; +/* +* slrp, soft limit reclaiming priority +* +* 0, by default, no slrp considered on soft reclaiming. +* +* 1-32, user configurable in ascending order, +* no page will be reclaimed from memcg of higher slrp in +* favor of memcg of lower slrp. +* +* only in direct reclaiming context now. +*/ +int slrp; +#define MEMCG_SLRP_MIN 1 +#define MEMCG_SLRP_MAX 32 +/* OOM-Killer disable */ int oom_kill_disable;
mm/memcontrol.c +73 -7
144 lines not on this page · raw message
Michal Hocko
maintainerQuoted 9 lines · Hillf Danton
Currently memory controler is playing increasingly important role in how memory is used and how pages are reclaimed on memory pressure.
In daily works memcg is often created for critical tasks and their pre configured memory usage is supposed to be met even on memory pressure. Administrator wants to make it configurable that the pages consumed by memcg-B can be reclaimed by page allocations invoked not by memcg-A but by memcg-C.
I am not really sure I understand the usecase well but this sounds like what memory reclaim protection in v2 is aiming at.
Quoted 3 lines
That configurability is addressed by adding priority for soft limit reclaiming to make sure that no pages will be reclaimed from memcg of higer priortiy in favor of memcg of lower priority.
cgroup v1 interfaces are generally frozen and mostly aimed at backward compatibility. I am especially concerned about adding a new way to control soft limit which is known to be misdesigned and unfixable to behave reasonably.
Quoted 7 lines
Pages are reclaimed with no priority being taken into account by default unless user turns it on, and then they are responsible for their smart activities almost the same way as they play realtime FIFO/RR games.
Priority is available only in the direct reclaiming context in order to advoid churning in the complex kswapd behavior.
Quoted 6 lines
Cc Shakeel Butt <[email protected]>Cc Roman Gushchin <[email protected]>Cc Matthew Wilcox <[email protected]>Cc Johannes Weiner <[email protected]>Cc Michal Hocko <[email protected]>Signed-off-by Hillf Danton <[email protected]>
That being said, you should describe the usecase and explain why v2 interface is not providing what you need. We might think about where to go from there but extending the soft limit reclaim is almost certainly not the right way to go.
Signature · 2 lines
Michal Hocko SUSE Labs
Quoted 6 lines · On Thu, 19 Sep 2019 21:32:31 +0800 Michal Hocko wrote:
Quoted 4 lines · Hillf Danton
Currently memory controler is playing increasingly important role in how memory is used and how pages are reclaimed on memory pressure.
Quoted 9 lines
Quoted 5 lines
In daily works memcg is often created for critical tasks and their pre configured memory usage is supposed to be met even on memory pressure. Administrator wants to make it configurable that the pages consumed by memcg-B can be reclaimed by page allocations invoked not by memcg-A but by memcg-C.
I am not really sure I understand the usecase well but this sounds like what memory reclaim protection in v2 is aiming at.
A tipoint to the v2 stuff please.
Quoted 9 lines
Quoted 3 lines
That configurability is addressed by adding priority for soft limit reclaiming to make sure that no pages will be reclaimed from memcg of higer priortiy in favor of memcg of lower priority.
cgroup v1 interfaces are generally frozen and mostly aimed at backward compatibility. I am especially concerned about adding a new way to control soft limit which is known to be misdesigned and unfixable to behave reasonably.
An URL to the drafts/works about the new way in your git tree.
Thanks
Hillf
Michal Hocko
maintainerQuoted 14 lines · Hillf Danton
Quoted 12 lines · On Thu, 19 Sep 2019 21:32:31 +0800 Michal Hocko wrote:
Quoted 9 lines · Hillf Danton
Currently memory controler is playing increasingly important role in how memory is used and how pages are reclaimed on memory pressure.
In daily works memcg is often created for critical tasks and their pre configured memory usage is supposed to be met even on memory pressure. Administrator wants to make it configurable that the pages consumed by memcg-B can be reclaimed by page allocations invoked not by memcg-A but by memcg-C.
Quoted 3 lines
Quoted 3 lines
I am not really sure I understand the usecase well but this sounds like what memory reclaim protection in v2 is aiming at.
Please describe the usecase.
Quoted 1 line
A tipoint to the v2 stuff please.
Documentation/admin-guide/cgroup-v2.rst
Quoted 10 lines
Quoted 9 lines
Quoted 3 lines
That configurability is addressed by adding priority for soft limit reclaiming to make sure that no pages will be reclaimed from memcg of higer priortiy in favor of memcg of lower priority.
cgroup v1 interfaces are generally frozen and mostly aimed at backward compatibility. I am especially concerned about adding a new way to control soft limit which is known to be misdesigned and unfixable to behave reasonably.
An URL to the drafts/works about the new way in your git tree.
Whut?
Signature · 2 lines
Michal Hocko SUSE Labs