diff --git a/mm/memcontrol.c b/mm/memcontrol.c index a628ca50dab47d..a1130ad8e63bc3 100644 --- a/mm/memcontrol.c +++ b/mm/memcontrol.c @@ -683,6 +683,15 @@ mem_cgroup_zoneinfo(struct mem_cgroup *memcg, int nid, int zid) return &memcg->nodeinfo[nid]->zoneinfo[zid]; } +static struct mem_cgroup_per_zone * +mem_cgroup_zoneinfo_zone(struct mem_cgroup *memcg, struct zone *zone) +{ + int nid = zone_to_nid(zone); + int zid = zone_idx(zone); + + return mem_cgroup_zoneinfo(memcg, nid, zid); +} + struct cgroup_subsys_state *mem_cgroup_css(struct mem_cgroup *memcg) { return &memcg->css; @@ -1234,11 +1243,9 @@ struct mem_cgroup *mem_cgroup_iter(struct mem_cgroup *root, int uninitialized_var(seq); if (reclaim) { - int nid = zone_to_nid(reclaim->zone); - int zid = zone_idx(reclaim->zone); struct mem_cgroup_per_zone *mz; - mz = mem_cgroup_zoneinfo(root, nid, zid); + mz = mem_cgroup_zoneinfo_zone(root, reclaim->zone); iter = &mz->reclaim_iter[reclaim->priority]; if (prev && reclaim->generation != iter->generation) { iter->last_visited = NULL; @@ -1345,7 +1352,7 @@ struct lruvec *mem_cgroup_zone_lruvec(struct zone *zone, goto out; } - mz = mem_cgroup_zoneinfo(memcg, zone_to_nid(zone), zone_idx(zone)); + mz = mem_cgroup_zoneinfo_zone(memcg, zone); lruvec = &mz->lruvec; out: /*