]> git.baikalelectronics.ru Git - kernel.git/commit
memcg: zap mem_cgroup_lookup()
authorVladimir Davydov <vdavydov@parallels.com>
Wed, 15 Apr 2015 23:13:00 +0000 (16:13 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 15 Apr 2015 23:35:16 +0000 (16:35 -0700)
commitb8fdd88290f542a9287b38aac8231adee732caa7
treee1fe1512cd36f2b7a5a978f473be7dc9d05021fa
parentb400d0c5df1f4d278bda29cac1cf7122f88cce9b
memcg: zap mem_cgroup_lookup()

mem_cgroup_lookup() is a wrapper around mem_cgroup_from_id(), which
checks that id != 0 before issuing the function call.  Today, there is
no point in this additional check apart from optimization, because there
is no css with id <= 0, so that css_from_id, called by
mem_cgroup_from_id, will return NULL for any id <= 0.

Since mem_cgroup_from_id is only called from mem_cgroup_lookup, let us
zap mem_cgroup_lookup, substituting calls to it with mem_cgroup_from_id
and moving the check if id > 0 to css_from_id.

Signed-off-by: Vladimir Davydov <vdavydov@parallels.com>
Acked-by: Michal Hocko <mhocko@suse.cz>
Cc: Johannes Weiner <hannes@cmpxchg.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
kernel/cgroup.c
mm/memcontrol.c