Skip to contentSkip to conversation

memcg-fix-memcg_kmem_bypass-for-remote-memcg-charging.patch removed from -mm tree

merged [email protected] 1 participant 1 message Jun 2, 2020

lore
Share & tools
lore

[email protected]

author tree notice Applied
#0 lore raw

The patch titled
Subject: memcg: fix memcg_kmem_bypass() for remote memcg charging
has been removed from the -mm tree. Its filename was
memcg-fix-memcg_kmem_bypass-for-remote-memcg-charging.patch

This patch was dropped because it was merged into mainline or a subsystem tree

------------------------------------------------------
From: Zefan Li <[email protected]>
Subject: memcg: fix memcg_kmem_bypass() for remote memcg charging

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.

As we will probably encounter this issue in the future as the users of memalloc_use_memcg() grow, and it's nothing wrong for this usage, it's better we fix it now.

---

 mm/memcontrol.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
mm/memcontrol.c renamed from mm/memcontrol.c~memcg-fix-memcg_kmem_bypass-for-remote-memcg-charging +6 -1
@@ -2852,7 +2852,12 @@ static void memcg_schedule_kmem_cache_cr
 
 static inline bool memcg_kmem_bypass(void)
 {
-	if (in_interrupt() || !current->mm || (current->flags & PF_KTHREAD))
+	if (in_interrupt())
+		return true;
+
+	/* Allow remote memcg charging in kthread contexts. */
+	if ((!current->mm || (current->flags & PF_KTHREAD)) &&
+	     !current->active_memcg)
 		return true;
 	return false;
 }

_

Patches currently in -mm which might be from [email protected] are