Skip to contentSkip to conversation

fix spurious EBUSY on memory cgroup removal

PATCH In review YAMAMOTO Takashi 2 participants 2 messages Feb 1, 2008 – Feb 2, 2008

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fix spurious EBUSY on memory cgroup removal

hi,

the following patch is to fix spurious EBUSY on cgroup removal.

YAMAMOTO Takashi

call mm_free_cgroup earlier.
otherwise a reference due to lazy mm switching can prevent cgroup removal.

---

kernel/fork.c renamed from kernel/fork.c.BACKUP +1 -1
@@ -393,7 +393,6 @@ void __mmdrop(struct mm_struct *mm)
 {
 	BUG_ON(mm == &init_mm);
 	mm_free_pgd(mm);
-	mm_free_cgroup(mm);
 	destroy_context(mm);
 	free_mm(mm);
 }
@@ -415,6 +414,7 @@ void mmput(struct mm_struct *mm)
 			spin_unlock(&mmlist_lock);
 		}
 		put_swap_token(mm);
+		mm_free_cgroup(mm);
 		mmdrop(mm);
 	}
 }
Acked-by on v1 1/1
#1 lore raw
Quoted 24 lines · YAMAMOTO Takashi

hi,

the following patch is to fix spurious EBUSY on cgroup removal.

YAMAMOTO Takashi

call mm_free_cgroup earlier.
otherwise a reference due to lazy mm switching can prevent cgroup removal.

---

kernel/fork.c renamed from kernel/fork.c.BACKUP +0 -1
@@ -393,7 +393,6 @@ void __mmdrop(struct mm_struct *mm)
 {
 	BUG_ON(mm == &init_mm);
 	mm_free_pgd(mm);
-	mm_free_cgroup(mm);
 	destroy_context(mm);
 	free_mm(mm);
 }

kernel/fork.c void mmput(struct mm_struct *mm) · line 420

Quoted 7 lines
kernel/fork.c renamed from kernel/fork.c.BACKUP +1 -0
@@ -415,6 +414,7 @@ void mmput(struct mm_struct *mm)
 			spin_unlock(&mmlist_lock);
 		}
 		put_swap_token(mm);
+		mm_free_cgroup(mm);
 		mmdrop(mm);
 	}
 }

The difference I see with the change is that mmput() will now call mm_free_cgroup() when mm->mm_users drop to 0 and __mmdrop() will call it when mm->mm_count drops to 0.

I think this change makes sense

Signature · 4 lines
	Warm Regards,
	Balbir Singh
	Linux Technology Center
	IBM, ISTL