summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2003-12-29 05:45:21 -0800
committerLinus Torvalds <torvalds@home.osdl.org>2003-12-29 05:45:21 -0800
commite2c3c9e216d884075e00c50f7a84b5a78cdd64fc (patch)
tree79ad91fa6da2a1914724d5d0ea2f5d1b8978474c /include
parente403669ebf740531b20b7e3a70fb16de1c6a3683 (diff)
[PATCH] Use NODES_SHIFT to calculate ZONE_SHIFT
From: jbarnes@sgi.com (Jesse Barnes) Now that we have a proper NODES_SHIFT value, we need to use it to define ZONE_SHIFT otherwise we'll spill over 8 bits if we have more than 85 nodes.
Diffstat (limited to 'include')
-rw-r--r--include/linux/mm.h4
-rw-r--r--include/linux/mmzone.h5
2 files changed, 7 insertions, 2 deletions
diff --git a/include/linux/mm.h b/include/linux/mm.h
index f72772e17665..9aa07674aaf5 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -322,8 +322,10 @@ static inline void put_page(struct page *page)
/*
* The zone field is never updated after free_area_init_core()
* sets it, so none of the operations on it need to be atomic.
+ * We'll have up to log2(MAX_NUMNODES * MAX_NR_ZONES) zones
+ * total, so we use NODES_SHIFT here to get enough bits.
*/
-#define ZONE_SHIFT (BITS_PER_LONG - 8)
+#define ZONE_SHIFT (BITS_PER_LONG - NODES_SHIFT - MAX_NR_ZONES_SHIFT)
struct zone;
extern struct zone *zone_table[];
diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
index c85e050c3104..a089e01dad03 100644
--- a/include/linux/mmzone.h
+++ b/include/linux/mmzone.h
@@ -159,7 +159,10 @@ struct zone {
#define ZONE_DMA 0
#define ZONE_NORMAL 1
#define ZONE_HIGHMEM 2
-#define MAX_NR_ZONES 3
+
+#define MAX_NR_ZONES 3 /* Sync this with MAX_NR_ZONES_SHIFT */
+#define MAX_NR_ZONES_SHIFT 2 /* ceil(log2(MAX_NR_ZONES)) */
+
#define GFP_ZONEMASK 0x03
/*