提交 50c31015 编写于 作者: J Johannes Weiner 提交者: Yang Yingliang

mm: memcontrol: replace node summing with memcg_page_state()

mainline inclusion
from mainline-5.2-rc1
commit 22796c84
category: bugfix
bugzilla: 34611
CVE: NA

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

Link: http://lkml.kernel.org/r/20190228163020.24100-4-hannes@cmpxchg.orgSigned-off-by: NJohannes Weiner <hannes@cmpxchg.org>
Reviewed-by: NRoman Gushchin <guro@fb.com>
Cc: Michal Hocko <mhocko@kernel.org>
Cc: Tejun Heo <tj@kernel.org>
Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
(cherry picked from commit 22796c84)
Signed-off-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NLiu Shixin <liushixin2@huawei.com>
Reviewed-by: NKefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: NYang Yingliang <yangyingliang@huawei.com>
上级 9af85687
...@@ -751,10 +751,13 @@ static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg, ...@@ -751,10 +751,13 @@ static unsigned long mem_cgroup_nr_lru_pages(struct mem_cgroup *memcg,
unsigned int lru_mask) unsigned int lru_mask)
{ {
unsigned long nr = 0; unsigned long nr = 0;
int nid; enum lru_list lru;
for_each_node_state(nid, N_MEMORY) for_each_lru(lru) {
nr += mem_cgroup_node_nr_lru_pages(memcg, nid, lru_mask); if (!(BIT(lru) & lru_mask))
continue;
nr += memcg_page_state(memcg, NR_LRU_BASE + lru);
}
return nr; return nr;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册