Skip to content

Commit

Permalink
[PATCH] mm: page_state fixes
Browse files Browse the repository at this point in the history
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: Nick Piggin <npiggin@suse.de>
Cc: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
  • Loading branch information
Nick Piggin authored and Linus Torvalds committed Jan 6, 2006
1 parent 2d92c5c commit a86b1f5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions mm/page_alloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -1169,12 +1169,11 @@ EXPORT_SYMBOL(nr_pagecache);
DEFINE_PER_CPU(long, nr_pagecache_local) = 0;
#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;

memset(ret, 0, sizeof(*ret));
cpus_and(*cpumask, *cpumask, cpu_online_map);

cpu = first_cpu(*cpumask);
while (cpu < NR_CPUS) {
Expand Down Expand Up @@ -1227,7 +1226,7 @@ unsigned long __read_page_state(unsigned long offset)
unsigned long ret = 0;
int cpu;

for_each_online_cpu(cpu) {
for_each_cpu(cpu) {
unsigned long in;

in = (unsigned long)&per_cpu(page_states, cpu) + offset;
Expand Down

0 comments on commit a86b1f5

Please sign in to comment.