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 <v...@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 485a3d354b78..5e16658a356f 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;
-- 
2.17.1

_______________________________________________
Devel mailing list
Devel@openvz.org
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to