[Devel] [PATCH RHEL7 COMMIT] memcg: fixes accounting for allocations called in "disabled BH" context

Vasily Averin vvs at virtuozzo.com
Mon Oct 5 10:36:38 MSK 2020


The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.32
------>
commit bdd0719de2dc72afa136ec5907aede4ab1db94cb
Author: Vasily Averin <vvs at virtuozzo.com>
Date:   Mon Oct 5 10:36:38 2020 +0300

    memcg: fixes accounting for allocations called in "disabled BH" context
    
    in_interrupt() check includes "have BH disabled" case,
    as result allocations called with disabled BH are not accounted to
    proper memory cgroup.
    
    https://jira.sw.ru/browse/PSBM-108292
    Signed-off-by: Vasily Averin <vvs at virtuozzo.com>
---
 include/linux/memcontrol.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/memcontrol.h b/include/linux/memcontrol.h
index 485a3d3..5e16658 100644
--- a/include/linux/memcontrol.h
+++ b/include/linux/memcontrol.h
@@ -644,7 +644,7 @@ memcg_kmem_newpage_charge(struct page *page, gfp_t gfp, int order)
 	 */
 	if (gfp & __GFP_NOFAIL)
 		return true;
-	if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD))
+	if (!in_task() || (!current->mm) || (current->flags & PF_KTHREAD))
 		return true;
 
 	/* If the test is dying, just let it go. */
@@ -682,7 +682,7 @@ memcg_kmem_get_cache(struct kmem_cache *cachep, gfp_t gfp)
 		return cachep;
 	if (gfp & __GFP_NOFAIL)
 		return cachep;
-	if (in_interrupt() || (!current->mm) || (current->flags & PF_KTHREAD))
+	if (!in_task() || (!current->mm) || (current->flags & PF_KTHREAD))
 		return cachep;
 	if (unlikely(fatal_signal_pending(current)))
 		return cachep;


More information about the Devel mailing list