On Thu 07-11-19 01:08:08, Yafang Shao wrote: > This patch introduces a new memory controller file memory.low.level, > which is used to set multiple levels memory.low protetion. > The valid value of memory.low.level is [0..3], meaning we support four > levels protection now. This new controller file takes effect only when > memory.low is set. With this new file, we can do page reclaim QoS on > different memcgs. For example, when the system is under memory pressure, it > will reclaim pages from the memcg with lower priority first and then higher > priority. > > - What is the problem in the current memory low proection ? > Currently we can set bigger memory.low protection on memcg with higher > priority, and smaller memory.low protection on memcg with lower priority. > But once there's no available unprotected memory to reclaim, the > reclaimers will reclaim the protected memory from all the memcgs. > While we really want the reclaimers to reclaim the protected memory from > the lower-priority memcgs first, and if it still can't meet the page > allocation it will then reclaim the protected memory from higher-priority > memdcgs. The logic can be displayed as bellow, > under_memory_pressure > reclaim_unprotected_memory > if (meet_the_request) > exit > reclaim_protected_memory_from_lowest_priority_memcgs > if (meet_the_request) > exit > reclaim_protected_memory_from_higher_priority_memcgs > if (meet_the_request) > exit > reclaim_protected_memory_from_highest_priority_memcgs Could you expand a bit more on the usecase please? Do you overcommit on the memory protection? Also why is this needed only for the reclaim protection? In other words let's say that you have more memcgs that are above their protection thresholds why should reclaim behave differently for them from the situation when all of them reach the protection? Also what about min reclaim protection? > - Why does it support four-level memory low protection ? > Low priority, medium priority and high priority, that is the most common > usecases in the real life. So four-level memory low protection should be > enough. The more levels it is, the higher overhead page reclaim will > take. So four-level protection is really a trade-off. Well, is this really the case? Isn't that just a matter of a proper implementation? Starting an API with a very restricted input values usually tends to outdate very quickly and it is found unsuitable. It would help to describe how do you envision using those priorities. E.g. do you have examples of what kind of services workloads fall into which priority. That being said there are quite some gaps in the usecase description as well the interface design. -- Michal Hocko SUSE Labs