mm/memcg: add unlikely to mercg->move_charge_at_immigrate
Subsystems (3)
Quoted 5 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
move_charge_at_immigratefeature is disabled by default. Charges are moved only when you movemm->ownerand 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.
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
@@ -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
Quoted 10 lines · Wanpeng Li
Quoted 9 lines · Glauber Costa
Quoted 5 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
move_charge_at_immigratefeature is disabled by default. Charges are moved only when you movemm->ownerand 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_immigratefeature is disabled by default. So add "unlikely", in order to compiler can optimize."
Again, do you have any reason to optimize that ?
Quoted 7 lines · Glauber Costa
Quoted 5 lines · Wanpeng Li
From: Wanpeng Li <[email protected]>
move_charge_at_immigratefeature is disabled by default. Charges are moved only when you movemm->ownerand 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
Quoted 10 lines · Wanpeng Li
Quoted 9 lines · Glauber Costa
Quoted 5 lines · Wanpeng Li
From: Wanpeng Li<[email protected]>
move_charge_at_immigratefeature is disabled by default. Charges are moved only when you movemm->ownerand 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_immigratefeature 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