[Devel] [PATCH VZ10 1/2] mm/memcontrol: don't recheck limits on consumed stock

Pavel Tikhomirov ptikhomirov at virtuozzo.com
Fri Jun 19 13:04:05 MSK 2026


Consuming stock is a fast path there we just use previously pre-charged
stock instead of actually charging anything. Since there is no actual
charge there is no need in time consuming limits vs charges recheck
through the ancestor cgroups.

https://virtuozzo.atlassian.net/browse/VSTOR-134021
Fixes: 0ad1e82744aba ("mm: Memory cgroup page cache limit")
Feature: mm: Memory cgroup page cache limit
Reported-by: Konstantin Khorenko <khorenko at virtuozzo.com>
Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 mm/memcontrol.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 661a220d50773..c6c45d4351dd0 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2405,7 +2405,7 @@ int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
 
 retry:
 	if (consume_stock(memcg, nr_pages, gfp_mask, cache_charge))
-		goto done;
+		return 0;
 
 	if (!gfpflags_allow_spinning(gfp_mask))
 		/* Avoid the refill and flush of the older stock */
@@ -2532,7 +2532,6 @@ int try_charge_memcg(struct mem_cgroup *memcg, gfp_t gfp_mask,
 	if (batch > nr_pages)
 		refill_stock(memcg, batch - nr_pages, cache_charge);
 
-done:
 	/*
 	 * If the hierarchy is above the normal consumption range, schedule
 	 * reclaim on returning to userland.  We can perform reclaim here
-- 
2.54.0



More information about the Devel mailing list