Skip to contentSkip to conversation

mm/memcg: add unlikely to mercg->move_charge_at_immigrate

PATCH In review Wanpeng Li 3 participants 5 messages Jun 18, 2012 – Jun 19, 2012

Subsystems (3)
lore
Share & tools
lore
#1 lore raw
In reply to Wanpeng Li
Quoted 5 lines · Wanpeng Li

From: Wanpeng Li <[email protected]>

move_charge_at_immigrate feature is disabled by default. Charges are moved only when you move mm->owner and it also add additional overhead.

How big is this overhead?

That's hardly a fast path. And if it happens to matter, it will be just bigger when you enable it, and the compiler start giving the wrong hints to the code.

Wanpeng Li

author
#0 lore raw

PATCH 1/1 mm/memcg: add unlikely to mercg->move_charge_at_immigrate

From: Wanpeng Li <[email protected]>

move_charge_at_immigrate feature is disabled by default. Charges are moved only when you move mm->owner and it also add additional overhead.

---
 mm/memcontrol.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
mm/memcontrol.c +1 -1
index a9c3d01..795a00f 100644
@@ -5316,7 +5316,7 @@ static int mem_cgroup_can_attach(struct cgroup *cgroup,
 	int ret = 0;
 	struct mem_cgroup *memcg = mem_cgroup_from_cont(cgroup);
 
-	if (memcg->move_charge_at_immigrate) {
+	if (unlikely(memcg->move_charge_at_immigrate)) {
 		struct mm_struct *mm;
 		struct mem_cgroup *from = mem_cgroup_from_task(p);
 
Signature · 1 line
1.7.9.5
#3 lore raw
In reply to Wanpeng Li
Quoted 10 lines · Wanpeng Li
Quoted 9 lines · Glauber Costa
Quoted 5 lines · Wanpeng Li

From: Wanpeng Li <[email protected]>

move_charge_at_immigrate feature is disabled by default. Charges are moved only when you move mm->owner and it also add additional overhead.

How big is this overhead?

Quoted 9 lines
Quoted 3 lines

That's hardly a fast path. And if it happens to matter, it will be just bigger when you enable it, and the compiler start giving the wrong hints to the code.

Thank you for your quick response.

Oh, Maybe I should just write comments "move_charge_at_immigrate feature is disabled by default. So add "unlikely", in order to compiler can optimize."

Again, do you have any reason to optimize that ?

author
#2 lore raw
In reply to Glauber Costa
Quoted 7 lines · Glauber Costa
Quoted 5 lines · Wanpeng Li

From: Wanpeng Li <[email protected]>

move_charge_at_immigrate feature is disabled by default. Charges are moved only when you move mm->owner and it also add additional overhead.

Quoted 5 lines

How big is this overhead?

That's hardly a fast path. And if it happens to matter, it will be just bigger when you enable it, and the compiler start giving the wrong hints to the code.

Thank you for your quick response.

Oh, Maybe I should just write comments "move_charge_at_immigrate feature is disabled by default. So add "unlikely", in order to compiler can optimize."

Best Regards,
Wanpeng Li

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe cgroups" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw
Quoted 10 lines · Wanpeng Li
Quoted 9 lines · Glauber Costa
Quoted 5 lines · Wanpeng Li

From: Wanpeng Li<[email protected]>

move_charge_at_immigrate feature is disabled by default. Charges are moved only when you move mm->owner and it also add additional overhead.

How big is this overhead?

Quoted 9 lines
Quoted 3 lines

That's hardly a fast path. And if it happens to matter, it will be just bigger when you enable it, and the compiler start giving the wrong hints to the code.

Thank you for your quick response.

Oh, Maybe I should just write comments "move_charge_at_immigrate feature is disabled by default. So add "unlikely", in order to compiler can optimize."

This doesn't affect the performance. likely/unlikely which doesn't affect performance is never welcomed.

Thanks,
-Kame