提交 a86b1f53 编写于 作者: N Nick Piggin 提交者: Linus Torvalds

[PATCH] mm: page_state fixes

read_page_state and __get_page_state only traverse online CPUs, which will
cause results to fluctuate when CPUs are plugged in or out.
Signed-off-by: NNick Piggin <npiggin@suse.de>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 2d92c5c9
...@@ -1169,12 +1169,11 @@ EXPORT_SYMBOL(nr_pagecache); ...@@ -1169,12 +1169,11 @@ EXPORT_SYMBOL(nr_pagecache);
DEFINE_PER_CPU(long, nr_pagecache_local) = 0; DEFINE_PER_CPU(long, nr_pagecache_local) = 0;
#endif #endif
void __get_page_state(struct page_state *ret, int nr, cpumask_t *cpumask) static void __get_page_state(struct page_state *ret, int nr, cpumask_t *cpumask)
{ {
int cpu = 0; int cpu = 0;
memset(ret, 0, sizeof(*ret)); memset(ret, 0, sizeof(*ret));
cpus_and(*cpumask, *cpumask, cpu_online_map);
cpu = first_cpu(*cpumask); cpu = first_cpu(*cpumask);
while (cpu < NR_CPUS) { while (cpu < NR_CPUS) {
...@@ -1227,7 +1226,7 @@ unsigned long __read_page_state(unsigned long offset) ...@@ -1227,7 +1226,7 @@ unsigned long __read_page_state(unsigned long offset)
unsigned long ret = 0; unsigned long ret = 0;
int cpu; int cpu;
for_each_online_cpu(cpu) { for_each_cpu(cpu) {
unsigned long in; unsigned long in;
in = (unsigned long)&per_cpu(page_states, cpu) + offset; in = (unsigned long)&per_cpu(page_states, cpu) + offset;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册