From: Matthew Dobson <colpatch@us.ibm.com>
To: Andrew Morton <akpm@osdl.org>
Cc: Jesse Barnes <jbarnes@sgi.com>,
"Martin J. Bligh" <mbligh@aracnet.com>,
linux-kernel@vger.kernel.org, rmk@arm.linux.org.uk,
wli@holomorphy.com
Subject: Re: [PATCH] you have how many nodes??
Date: Fri, 19 Sep 2003 15:01:46 -0700 [thread overview]
Message-ID: <3F6B7CCA.5040702@us.ibm.com> (raw)
In-Reply-To: 3F6659DF.1090508@us.ibm.com
[-- Attachment #1: Type: text/plain, Size: 1326 bytes --]
Andrew,
Here's a small update to the numnodes fix that went into -mm3. The
biggest changes are:
1) move the actual NODES_SHIFT and MAX_NUMNODES definitions into
linux/numa.h and include this in linux/mmzone.h, instead of being
directly in linux/mmzone.h. This allows other files to include *just*
the NUMNODES stuff w/out grabbing all of mmzone.h.
2) pull NODE_SHIFT out of linux/mm.h. This isn't used anywhere in the
kernel, and it will only get confused with NODES_SHIFT.
3) Fix the IA64 patch. The original patch I had sent out hadn't been
tested on IA64. It was mostly right, but there were circular
dependencies. All better now, and acked by Jesse.
4) In linux/mmzone.h, insert code to define MAX_NODES_SHIFT based on
the size of unsigned long. For 64-bit arches, we can have a much larger
value. This allows IA64 to have 100's or 1000's of nodes.
MAX_NODES_SHIFT is defined as 10 (ie: 1024 nodes) for 64-bit for now,
although it could likely be much larger. For 32-bit it is 6 (ie: 64 nodes).
5) Small cleanup in include/asm-arm/memory.h. Mostly the result of the
new linux/numa.h file. Much cleaner and more readable now.
Russell, if you get a chance, I'd really appreciate a sanity check on
the arm code. It really hasn't been tested, but the changes are pretty
small.
Cheers!
-Matt
[-- Attachment #2: numnodes_update.patch --]
[-- Type: text/plain, Size: 6117 bytes --]
diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.6.0-test5-mm3/include/asm-arm/memory.h linux-2.6.0-test5-numnodes_update/include/asm-arm/memory.h
--- linux-2.6.0-test5-mm3/include/asm-arm/memory.h Fri Sep 19 14:05:33 2003
+++ linux-2.6.0-test5-numnodes_update/include/asm-arm/memory.h Fri Sep 19 14:52:11 2003
@@ -84,27 +84,24 @@ static inline void *phys_to_virt(unsigne
#define PHYS_TO_NID(addr) (0)
-#else
+#else /* CONFIG_DISCONTIGMEM */
+
/*
* This is more complex. We have a set of mem_map arrays spread
* around in memory.
*/
-#include <asm/numnodes.h>
-#define NUM_NODES (1 << NODES_SHIFT)
+#include <linux/numa.h>
#define page_to_pfn(page) \
(( (page) - page_zone(page)->zone_mem_map) \
+ page_zone(page)->zone_start_pfn)
-
#define pfn_to_page(pfn) \
(PFN_TO_MAPBASE(pfn) + LOCAL_MAP_NR((pfn) << PAGE_SHIFT))
-
-#define pfn_valid(pfn) (PFN_TO_NID(pfn) < NUM_NODES)
+#define pfn_valid(pfn) (PFN_TO_NID(pfn) < MAX_NUMNODES)
#define virt_to_page(kaddr) \
(ADDR_TO_MAPBASE(kaddr) + LOCAL_MAP_NR(kaddr))
-
-#define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < NUM_NODES)
+#define virt_addr_valid(kaddr) (KVADDR_TO_NID(kaddr) < MAX_NUMNODES)
/*
* Common discontigmem stuff.
@@ -112,9 +109,7 @@ static inline void *phys_to_virt(unsigne
*/
#define PHYS_TO_NID(addr) PFN_TO_NID((addr) >> PAGE_SHIFT)
-#undef NUM_NODES
-
-#endif
+#endif /* !CONFIG_DISCONTIGMEM */
/*
* For BIO. "will die". Kill me when bio_to_phys() and bvec_to_phys() die.
diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.6.0-test5-mm3/include/asm-ia64/nodedata.h linux-2.6.0-test5-numnodes_update/include/asm-ia64/nodedata.h
--- linux-2.6.0-test5-mm3/include/asm-ia64/nodedata.h Fri Sep 19 14:05:33 2003
+++ linux-2.6.0-test5-numnodes_update/include/asm-ia64/nodedata.h Fri Sep 19 14:52:13 2003
@@ -8,13 +8,11 @@
* Copyright (c) 2002 Erich Focht <efocht@ess.nec.de>
* Copyright (c) 2002 Kimio Suganuma <k-suganuma@da.jp.nec.com>
*/
-
-
#ifndef _ASM_IA64_NODEDATA_H
#define _ASM_IA64_NODEDATA_H
-
-#include <linux/mmzone.h>
+#include <linux/numa.h>
+#include <asm/mmzone.h>
/*
* Node Data. One of these structures is located on each node of a NUMA system.
@@ -24,7 +22,7 @@ struct pglist_data;
struct ia64_node_data {
short active_cpu_count;
short node;
- struct pglist_data *pg_data_ptrs[MAX_NUMNODES];
+ struct pglist_data *pg_data_ptrs[MAX_NUMNODES];
struct page *bank_mem_map_base[NR_BANKS];
struct ia64_node_data *node_data_ptrs[MAX_NUMNODES];
short node_id_map[NR_BANKS];
diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.6.0-test5-mm3/include/asm-ia64/numa.h linux-2.6.0-test5-numnodes_update/include/asm-ia64/numa.h
--- linux-2.6.0-test5-mm3/include/asm-ia64/numa.h Fri Sep 19 14:05:33 2003
+++ linux-2.6.0-test5-numnodes_update/include/asm-ia64/numa.h Fri Sep 19 14:52:13 2003
@@ -13,9 +13,9 @@
#ifdef CONFIG_NUMA
-#include <linux/mmzone.h>
-
+#include <linux/numa.h>
#include <linux/cache.h>
+
extern volatile char cpu_to_node_map[NR_CPUS] __cacheline_aligned;
extern volatile unsigned long node_to_cpu_mask[MAX_NUMNODES] __cacheline_aligned;
diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.6.0-test5-mm3/include/asm-ia64/sn/pda.h linux-2.6.0-test5-numnodes_update/include/asm-ia64/sn/pda.h
--- linux-2.6.0-test5-mm3/include/asm-ia64/sn/pda.h Fri Sep 19 14:05:33 2003
+++ linux-2.6.0-test5-numnodes_update/include/asm-ia64/sn/pda.h Fri Sep 19 14:52:13 2003
@@ -10,7 +10,7 @@
#include <linux/config.h>
#include <linux/cache.h>
-#include <linux/mmzone.h>
+#include <linux/numa.h>
#include <asm/percpu.h>
#include <asm/system.h>
#include <asm/processor.h>
diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.6.0-test5-mm3/include/linux/mm.h linux-2.6.0-test5-numnodes_update/include/linux/mm.h
--- linux-2.6.0-test5-mm3/include/linux/mm.h Fri Sep 19 14:05:37 2003
+++ linux-2.6.0-test5-numnodes_update/include/linux/mm.h Fri Sep 19 14:52:04 2003
@@ -323,7 +323,6 @@ static inline void put_page(struct 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.
*/
-#define NODE_SHIFT 4
#define ZONE_SHIFT (BITS_PER_LONG - 8)
struct zone;
diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.6.0-test5-mm3/include/linux/mmzone.h linux-2.6.0-test5-numnodes_update/include/linux/mmzone.h
--- linux-2.6.0-test5-mm3/include/linux/mmzone.h Fri Sep 19 14:05:37 2003
+++ linux-2.6.0-test5-numnodes_update/include/linux/mmzone.h Fri Sep 19 14:52:06 2003
@@ -10,14 +10,8 @@
#include <linux/wait.h>
#include <linux/cache.h>
#include <linux/threads.h>
+#include <linux/numa.h>
#include <asm/atomic.h>
-#ifdef CONFIG_DISCONTIGMEM
-#include <asm/numnodes.h>
-#endif
-#ifndef NODES_SHIFT
-#define NODES_SHIFT 0
-#endif
-#define MAX_NUMNODES (1 << NODES_SHIFT)
/* Free memory management - zoned buddy allocator. */
#ifndef CONFIG_FORCE_MAX_ZONEORDER
@@ -313,12 +307,19 @@ extern struct pglist_data contig_page_da
#else /* CONFIG_DISCONTIGMEM */
#include <asm/mmzone.h>
+
+#if BITS_PER_LONG == 32
/*
- * page->zone is currently 8 bits
- * there are 3 zones (2 bits)
- * this leaves 8-2=6 bits for nodes
+ * with 32 bit flags field, page->zone is currently 8 bits.
+ * there are 3 zones (2 bits) and this leaves 8-2=6 bits for nodes.
*/
#define MAX_NODES_SHIFT 6
+#elif BITS_PER_LONG == 64
+/*
+ * with 64 bit flags field, there's plenty of room.
+ */
+#define MAX_NODES_SHIFT 10
+#endif
#endif /* !CONFIG_DISCONTIGMEM */
diff -Nurp --exclude-from=/home/mcd/.dontdiff linux-2.6.0-test5-mm3/include/linux/numa.h linux-2.6.0-test5-numnodes_update/include/linux/numa.h
--- linux-2.6.0-test5-mm3/include/linux/numa.h Wed Dec 31 16:00:00 1969
+++ linux-2.6.0-test5-numnodes_update/include/linux/numa.h Fri Sep 19 14:52:04 2003
@@ -0,0 +1,16 @@
+#ifndef _LINUX_NUMA_H
+#define _LINUX_NUMA_H
+
+#include <linux/config.h>
+
+#ifdef CONFIG_DISCONTIGMEM
+#include <asm/numnodes.h>
+#endif
+
+#ifndef NODES_SHIFT
+#define NODES_SHIFT 0
+#endif
+
+#define MAX_NUMNODES (1 << NODES_SHIFT)
+
+#endif /* _LINUX_NUMA_H */
next prev parent reply other threads:[~2003-09-19 22:04 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-09-10 21:36 [PATCH] you have how many nodes?? Jesse Barnes
2003-09-10 22:12 ` Andrew Morton
2003-09-10 22:34 ` Jesse Barnes
2003-09-10 22:36 ` Andrew Morton
2003-09-10 23:46 ` Martin J. Bligh
2003-09-11 0:03 ` Jesse Barnes
2003-09-16 0:31 ` Matthew Dobson
2003-09-16 0:34 ` [PATCH] Clean up MAX_NR_NODES/NUMNODES/etc. [1/5] Matthew Dobson
2003-09-16 12:43 ` Matthew Dobson
2003-09-16 0:35 ` [PATCH[ Clean up MAX_NR_NODES/NUMNODES/etc. [2/5] Matthew Dobson
2003-09-16 0:36 ` [PATCH] Clean up MAX_NR_NODES/NUMNODES/etc. [3/5] Matthew Dobson
2003-09-16 0:37 ` [PATCH] Clean up MAX_NR_NODES/NUMNODES/etc. [4/5] Matthew Dobson
2003-09-16 0:37 ` [PATCH] Clean up MAX_NR_NODES/NUMNODES/etc. [5/5] Matthew Dobson
2003-09-16 16:47 ` Jesse Barnes
2003-09-19 22:01 ` Matthew Dobson [this message]
2003-10-21 17:44 ` [PATCH] you have how many nodes?? Jesse Barnes
2003-09-11 0:52 ` William Lee Irwin III
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F6B7CCA.5040702@us.ibm.com \
--to=colpatch@us.ibm.com \
--cc=akpm@osdl.org \
--cc=jbarnes@sgi.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@aracnet.com \
--cc=rmk@arm.linux.org.uk \
--cc=wli@holomorphy.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.