[Devel] [PATCH RHEL10 COMMIT] mm/memcontrol: don't recheck limits on consumed stock

Konstantin Khorenko khorenko at virtuozzo.com
Fri Jun 19 13:46:43 MSK 2026


The commit is pushed to "branch-rh10-6.12.0-211.16.1.12.x.vz10-ovz" and will appear at git at bitbucket.org:openvz/vzkernel.git
after rh10-6.12.0-211.16.1.12.4.vz10
------>
commit ab987e5b831ceb644c8cba8826cca369db30cddd
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Fri Jun 19 12:04:05 2026 +0200

    mm/memcontrol: don't recheck limits on consumed stock
    
    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


More information about the Devel mailing list