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 <[email protected]>
Signed-off-by: Pavel Tikhomirov <[email protected]>
---
 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

_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to