linux-mm.kvack.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] memcg: Fix memcg_kmem_bypass() for remote memcg charging
@ 2020-05-13  7:28 Zefan Li
  2020-05-13  9:05 ` Michal Hocko
  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, 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@huawei.com>
---

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
2020-05-13  9:05 ` Michal Hocko
2020-05-13 11:19   ` Zefan Li
2020-05-13 11:29     ` Michal Hocko
2020-05-13 11:47       ` [PATCH v2] " Zefan Li
2020-05-13 12:22         ` Shakeel Butt
2020-05-13 13:05         ` Johannes Weiner
2020-05-13 16:11         ` Roman Gushchin
2020-05-14  1:16           ` Zefan Li
2020-05-14 22:52             ` Roman Gushchin
2020-05-15  6:56               ` Michal Hocko
2020-05-15  8:20                 ` Zefan Li
2020-05-15  8:34                   ` Michal Hocko
2020-05-15 16:22                     ` Shakeel Butt
2020-05-15 17:31                       ` Roman Gushchin
2020-05-18  9:13                       ` Michal Hocko
2020-05-26  1:25       ` [PATCH v3] " Zefan Li
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;
as well as URLs for NNTP newsgroup(s).