Adding linux-mm and related folks. On Wed, May 26, 2021 at 9:18 AM <yulei.kernel@xxxxxxxxx> wrote: > > From: Yulei Zhang <yuleixzhang@xxxxxxxxxxx> > > In this patch set we present the idea to suppress the memory allocation > speed in memory cgroup, which aims to avoid direct reclaim caused by > memory allocation burst while under memory pressure. > I am assuming here direct reclaim means global reclaim. > As minimum watermark could be easily broken if certain tasks allocate > massive amount of memory in a short period of time, in that case it will > trigger the direct memory reclaim and cause unacceptable jitters for > latency critical tasks, such as guaranteed pod task in K8s. > > With memory allocation speed throttle(mst) mechanism we could lower the > memory allocation speed in certian cgroup, usually for low priority tasks, > so that could avoid the direct memory reclaim in time. Can you please explain why memory.high is not good enough for your use-case? You can orchestrate the memory.high limits in such a way that those certain cgroups hit their memory.high limit before causing the global reclaim. You might need to dynamically adjust the limits based on other workloads or unaccounted memory. > > And per-memcg interfaces are introduced under memcg tree, not visiable for > root memcg. > - <cgroup_root>/<cgroup_name>/memory.alloc_bps > - 0 -> means memory speed throttle disabled > - non-zero -> value in bytes for memory allocation speed limits > > - <cgroup_root>/<cgroup_name>/memory.stat:mst_mem_spd_max > it records the max memory allocation speed of the memory cgroup in the > last period of time slice > > - <cgroup_root>/<cgroup_name>/memory.stat:mst_nr_throttled > it represents the number of times for allocation throttling > > Yulei Zhang (7): > mm: record total charge and max speed counter in memcg > mm: introduce alloc_bps to memcg for memory allocation speed throttle > mm: memory allocation speed throttle setup in hierarchy > mm: introduce slice analysis into memory speed throttle mechanism > mm: introduce memory allocation speed throttle > mm: record the numbers of memory allocation throttle > mm: introduce mst low and min watermark > > include/linux/memcontrol.h | 23 +++ > include/linux/page_counter.h | 8 + > init/Kconfig | 8 + > mm/memcontrol.c | 295 +++++++++++++++++++++++++++++++++++ > mm/page_counter.c | 39 +++++ > 5 files changed, 373 insertions(+) > > -- > 2.28.0 >