mm: memcontrol: Don't css_get() on root_mem_cgroup in get_mem_cgroup_from_mm()
Subsystems (3)
PATCH 1/1 mm: memcontrol: Don't css_get() on root_mem_cgroup in get_mem_cgroup_from_mm()
As reference counting in the root memcg is disabled, there is no need to get a reference if root memcg is to be returned.
Signed-off-by Waiman Long <[email protected]>
--- mm/memcontrol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
mm/memcontrol.c +3 -1
@@ -1060,8 +1060,10 @@ struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm)rcu_read_lock ();do { memcg =mem_cgroup_from_task (rcu_dereference (mm->owner)); -if (unlikely (!memcg)) +if (unlikely (!memcg)) { memcg = root_mem_cgroup; +break ; + } }while (!css_tryget (&memcg->css));rcu_read_unlock ();return memcg;
Signature · 1 line
2.39.3
Quoted 2 lines · Waiman Long
As reference counting in the root memcg is disabled, there is no need to get a reference if root memcg is to be returned.
Does this give any measurable wins?
Quoted 23 lines
Signed-off-by Waiman Long <[email protected]>--- mm/memcontrol.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)mm/memcontrol.c +3
-1@@ -1060,8 +1060,10 @@ struct mem_cgroup *get_mem_cgroup_from_mm(struct mm_struct *mm)rcu_read_lock ();do { memcg =mem_cgroup_from_task (rcu_dereference (mm->owner)); -if (unlikely (!memcg)) +if (unlikely (!memcg)) { memcg = root_mem_cgroup; +break ; + } }while (!css_tryget (&memcg->css));rcu_read_unlock ();return memcg;Signature · 1 line
2.39.3
Signature · 2 lines
Michal Hocko SUSE Labs