Commit 1a61ab80 authored by Johannes Weiner's avatar Johannes Weiner Committed by Linus Torvalds

mm: memcontrol: replace zone summing with lruvec_page_state()

Instead of adding up the zone counters, use lruvec_page_state() to get the
node state directly.  This is a bit cheaper and more stream-lined.

Link: http://lkml.kernel.org/r/20190228163020.24100-3-hannes@cmpxchg.orgSigned-off-by: default avatarJohannes Weiner <hannes@cmpxchg.org>
Reviewed-by: default avatarRoman Gushchin <guro@fb.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent e0ee0e71
...@@ -504,19 +504,6 @@ void mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru, ...@@ -504,19 +504,6 @@ void mem_cgroup_update_lru_size(struct lruvec *lruvec, enum lru_list lru,
unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg,
int nid, unsigned int lru_mask); int nid, unsigned int lru_mask);
static inline
unsigned long mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru)
{
struct mem_cgroup_per_node *mz;
unsigned long nr_pages = 0;
int zid;
mz = container_of(lruvec, struct mem_cgroup_per_node, lruvec);
for (zid = 0; zid < MAX_NR_ZONES; zid++)
nr_pages += mz->lru_zone_size[zid][lru];
return nr_pages;
}
static inline static inline
unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec,
enum lru_list lru, int zone_idx) enum lru_list lru, int zone_idx)
...@@ -960,11 +947,6 @@ static inline bool mem_cgroup_online(struct mem_cgroup *memcg) ...@@ -960,11 +947,6 @@ static inline bool mem_cgroup_online(struct mem_cgroup *memcg)
return true; return true;
} }
static inline unsigned long
mem_cgroup_get_lru_size(struct lruvec *lruvec, enum lru_list lru)
{
return 0;
}
static inline static inline
unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec, unsigned long mem_cgroup_get_zone_lru_size(struct lruvec *lruvec,
enum lru_list lru, int zone_idx) enum lru_list lru, int zone_idx)
......
...@@ -737,7 +737,7 @@ unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg, ...@@ -737,7 +737,7 @@ unsigned long mem_cgroup_node_nr_lru_pages(struct mem_cgroup *memcg,
for_each_lru(lru) { for_each_lru(lru) {
if (!(BIT(lru) & lru_mask)) if (!(BIT(lru) & lru_mask))
continue; continue;
nr += mem_cgroup_get_lru_size(lruvec, lru); nr += lruvec_page_state(lruvec, NR_LRU_BASE + lru);
} }
return nr; return nr;
} }
......
...@@ -346,7 +346,7 @@ unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone ...@@ -346,7 +346,7 @@ unsigned long lruvec_lru_size(struct lruvec *lruvec, enum lru_list lru, int zone
int zid; int zid;
if (!mem_cgroup_disabled()) if (!mem_cgroup_disabled())
lru_size = mem_cgroup_get_lru_size(lruvec, lru); lru_size = lruvec_page_state(lruvec, NR_LRU_BASE + lru);
else else
lru_size = node_page_state(lruvec_pgdat(lruvec), NR_LRU_BASE + lru); lru_size = node_page_state(lruvec_pgdat(lruvec), NR_LRU_BASE + lru);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment