2005-10-13 19:01:53

by John Hawkes

[permalink] [raw]
Subject: [PATCH] 2.6.14-rc4: wider use of for_each_*cpu() in mm

In 'mm' change the explicit use of a for-loop using NR_CPUS into the
general for_each_cpu() constructs. This widens the scope of potential
future optimizations of the general constructs, as well as takes
advantage of the existing optimizations of first_cpu() and next_cpu(),
which is advantageous when the true CPU count is much smaller than NR_CPUS.

Signed-off-by: John Hawkes <[email protected]>

Index: linux/mm/page_alloc.c
===================================================================
--- linux.orig/mm/page_alloc.c 2005-10-13 09:29:53.000000000 -0700
+++ linux/mm/page_alloc.c 2005-10-13 09:30:36.000000000 -0700
@@ -1305,12 +1305,9 @@
} else
printk("\n");

- for (cpu = 0; cpu < NR_CPUS; ++cpu) {
+ for_each_cpu(cpu) {
struct per_cpu_pageset *pageset;

- if (!cpu_possible(cpu))
- continue;
-
pageset = zone_pcp(zone, cpu);

for (temperature = 0; temperature < 2; temperature++)