]> git.baikalelectronics.ru Git - kernel.git/commit
mm: memcg/slab: cache page number in memcg_(un)charge_slab()
authorRoman Gushchin <guro@fb.com>
Thu, 2 Apr 2020 04:06:53 +0000 (21:06 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 2 Apr 2020 16:35:28 +0000 (09:35 -0700)
commit042fc6e08d073c53b469be6ed382455c20dcd7a8
tree117f85eec908dc074f9e463be4f54d0ee7823237
parentf90a3de274d1a54aa2ee952782f09c3a889fa833
mm: memcg/slab: cache page number in memcg_(un)charge_slab()

There are many places in memcg_charge_slab() and memcg_uncharge_slab()
which are calculating the number of pages to charge, css references to
grab etc depending on the order of the slab page.

Let's simplify the code by calculating it once and caching in the local
variable.

Signed-off-by: Roman Gushchin <guro@fb.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Reviewed-by: Shakeel Butt <shakeelb@google.com>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Link: http://lkml.kernel.org/r/20200109202659.752357-6-guro@fb.com
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/slab.h