From: Andrey Ryabinin <aryabi...@virtuozzo.com> Exceeding cache above cache.limit_in_bytes schedules high_work_func() which tries to reclaim 32 pages. If cache generated fast enough or it allows cgroup to steadily grow above cache.limit_in_bytes because we don't reclaim enough. Try to reclaim exceeded amount of cache instead.
https://jira.sw.ru/browse/PSBM-106384 Signed-off-by: Andrey Ryabinin <aryabi...@virtuozzo.com> (cherry picked from commit 098f6a9add74a10848494427046cb8087ceb27d1) https://jira.sw.ru/browse/PSBM-131957 Signed-off-by: Alexander Mikhalitsyn <alexander.mikhalit...@virtuozzo.com> --- mm/memcontrol.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mm/memcontrol.c b/mm/memcontrol.c index 46fa926e35e2..2af9c460a06d 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -2538,6 +2538,8 @@ static unsigned long reclaim_high(struct mem_cgroup *memcg, unsigned long nr_reclaimed = 0; do { + long cache_overused; + if (page_counter_read(&memcg->memory) > READ_ONCE(memcg->memory.high)) { memcg_memory_event(memcg, MEMCG_HIGH); @@ -2545,9 +2547,12 @@ static unsigned long reclaim_high(struct mem_cgroup *memcg, nr_pages, gfp_mask, true); } - if (page_counter_read(&memcg->cache) > memcg->cache.max) + cache_overused = page_counter_read(&memcg->cache) - + memcg->cache.max; + + if (cache_overused > 0) nr_reclaimed += try_to_free_mem_cgroup_pages(memcg, - nr_pages, gfp_mask, false); + cache_overused, gfp_mask, false); } while ((memcg = parent_mem_cgroup(memcg)) && !mem_cgroup_is_root(memcg)); -- 2.28.0 _______________________________________________ Devel mailing list Devel@openvz.org https://lists.openvz.org/mailman/listinfo/devel