[Devel,RHEL7,COMMIT] ms/memcg: remove unnecessary !mm check from try_get_mem_cgroup_from_mm()

Submitted by Konstantin Khorenko on Jan. 16, 2017, 4:27 p.m.

Details

Message ID 201701161627.v0GGR5bT027578@finist_cl7.x64_64.work.ct
State New
Series "Series without cover letter"
Headers show

Commit Message

Konstantin Khorenko Jan. 16, 2017, 4:27 p.m.
The commit is pushed to "branch-rh7-3.10.0-514.vz7.27.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.vz7.27.10
------>
commit 9931201ae279edcc3709932f9fcd2cf531f31909
Author: Johannes Weiner <hannes@cmpxchg.org>
Date:   Mon Jan 16 20:27:05 2017 +0400

    ms/memcg: remove unnecessary !mm check from try_get_mem_cgroup_from_mm()
    
    Users pass either a mm that has been established under task lock, or use
    a verified current->mm, which means the task can't be exiting.
    
    Signed-off-by: Johannes Weiner <hannes@cmpxchg.org>
    Acked-by: Michal Hocko <mhocko@suse.cz>
    Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
    Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
    
    https://jira.sw.ru/browse/PSBM-51558
    (cherry picked from commit 03583f1a631c0511dfd2f16e716d5b40f675de5a)
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 mm/memcontrol.c | 7 -------
 1 file changed, 7 deletions(-)

Patch hide | download patch | download mbox

diff --git a/mm/memcontrol.c b/mm/memcontrol.c
index 7b2a99f..d09d55d9 100644
--- a/mm/memcontrol.c
+++ b/mm/memcontrol.c
@@ -1170,13 +1170,6 @@  struct mem_cgroup *try_get_mem_cgroup_from_mm(struct mm_struct *mm)
 {
 	struct mem_cgroup *memcg = NULL;
 
-	if (!mm)
-		return NULL;
-	/*
-	 * Because we have no locks, mm->owner's may be being moved to other
-	 * cgroup. We use css_tryget() here even if this looks
-	 * pessimistic (rather than adding locks here).
-	 */
 	rcu_read_lock();
 	do {
 		memcg = mem_cgroup_from_task(rcu_dereference(mm->owner));