[Devel] [PATCH RHEL7 COMMIT] mm/memcg: Charge memsw as well in __GFP_NOFAIL case

Konstantin Khorenko khorenko at virtuozzo.com
Thu May 5 14:51:43 MSK 2022


The commit is pushed to "branch-rh7-3.10.0-1160.62.1.vz7.187.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1160.62.1.vz7.187.1
------>
commit 0bdb35ee50226302c6c57fe5e22f2beab7578669
Author: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
Date:   Thu May 5 14:43:00 2022 +0300

    mm/memcg: Charge memsw as well in __GFP_NOFAIL case
    
    RedHat has ported ms commit 10d53c748bc9 ("memcg: ratify and consolidate
    over-charge handling") but forgotten to charge memsw in __GFP_NOFAIL
    case, so fix this.
    
    Fixes: 8a9bfaf5d824 ("rh7: import RHEL7 kernel-3.10.0-1160.62.1.el7")
    https://jira.sw.ru/browse/PSBM-139519
    
    Signed-off-by: Pavel Tikhomirov <ptikhomirov at virtuozzo.com>
---
 mm/memcontrol.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 649e4cc37f24..fdc5245e48a9 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -3336,6 +3336,8 @@ static int try_charge(struct mem_cgroup *memcg, gfp_t gfp_mask, bool kmem_charge
 		 * charging allocations that carry the __GFP_NOFAIL flag.
 		 */
 		page_counter_charge(&memcg->memory, batch);
+		if (do_swap_account)
+			page_counter_charge(&memcg->memsw, batch);
 	} else
 		mem_over_limit = mem_cgroup_from_counter(counter, memory);
 


More information about the Devel mailing list