public inbox for cgroups@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] memcg: Fix memcg_kmem_bypass() for remote memcg charging
@ 2020-05-13  7:28 Zefan Li
       [not found] ` <e6927a82-949c-bdfd-d717-0a14743c6759-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
  0 siblings, 1 reply; 20+ messages in thread
From: Zefan Li @ 2020-05-13  7:28 UTC (permalink / raw)
  To: Johannes Weiner, Michal Hocko, Vladimir Davydov
  Cc: Cgroups, linux-mm-Bw31MaZKKs3YtjvyW6yDsg, Andrew Morton

While trying to use remote memcg charging in an out-of-tree kernel module
I found it's not working, because the current thread is a workqueue thread.

Signed-off-by: Zefan Li <lizefan-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
---

No need to queue this for v5.7 as currently no upstream users of this memcg
feature suffer from this bug.

---
 mm/memcontrol.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index a3b97f1..db836fc 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -2802,6 +2802,8 @@ static void memcg_schedule_kmem_cache_create(struct mem_cgroup *memcg,
 
 static inline bool memcg_kmem_bypass(void)
 {
+	if (unlikely(current->active_memcg))
+		return false;
 	if (in_interrupt() || !current->mm || (current->flags & PF_KTHREAD))
 		return true;
 	return false;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2020-05-28 14:44 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-13  7:28 [PATCH] memcg: Fix memcg_kmem_bypass() for remote memcg charging Zefan Li
     [not found] ` <e6927a82-949c-bdfd-d717-0a14743c6759-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2020-05-13  9:05   ` Michal Hocko
     [not found]     ` <20200513090502.GV29153-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2020-05-13 11:19       ` Zefan Li
     [not found]         ` <76f71776-d049-7407-8574-86b6e9d80704-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2020-05-13 11:29           ` Michal Hocko
     [not found]             ` <20200513112905.GX29153-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2020-05-13 11:47               ` [PATCH v2] " Zefan Li
     [not found]                 ` <3a721f62-5a66-8bc5-247b-5c8b7c51c555-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2020-05-13 12:22                   ` Shakeel Butt
2020-05-13 13:05                   ` Johannes Weiner
2020-05-13 16:11                   ` Roman Gushchin
     [not found]                     ` <20200513161110.GA70427-lLJQVQxiE4uLfgCeKHXN1g2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2020-05-14  1:16                       ` Zefan Li
     [not found]                         ` <20e89344-cf00-8b0c-64c3-0ac7efd601e6-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2020-05-14 22:52                           ` Roman Gushchin
     [not found]                             ` <20200514225259.GA81563-cx5fftMpWqeCjSd+JxjunQ2O0Ztt9esIQQ4Iyu8u01E@public.gmane.org>
2020-05-15  6:56                               ` Michal Hocko
     [not found]                                 ` <20200515065645.GD29153-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2020-05-15  8:20                                   ` Zefan Li
     [not found]                                     ` <bad0e16b-7141-94c0-45f6-6ed03926b5f8-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2020-05-15  8:34                                       ` Michal Hocko
     [not found]                                         ` <20200515083458.GK29153-2MMpYkNvuYDjFM9bn6wA6Q@public.gmane.org>
2020-05-15 16:22                                           ` Shakeel Butt
     [not found]                                             ` <CALvZod64-Yc0firp9C8MNhEaF6FTiKmSx2B3HOrvi8GkyOD-7g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2020-05-15 17:31                                               ` Roman Gushchin
2020-05-18  9:13                                               ` Michal Hocko
2020-05-26  1:25               ` [PATCH v3] " Zefan Li
     [not found]                 ` <1d202a12-26fe-0012-ea14-f025ddcd044a-hv44wF8Li93QT0dZR+AlfA@public.gmane.org>
2020-05-26 15:53                   ` Roman Gushchin
2020-05-27 16:50                   ` Shakeel Butt
2020-05-28 14:44                   ` Michal Hocko

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox