All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA
@ 2004-01-19 13:05 Jes Sorensen
  2004-01-19 20:08 ` Martin J. Bligh
  0 siblings, 1 reply; 11+ messages in thread
From: Jes Sorensen @ 2004-01-19 13:05 UTC (permalink / raw)
  To: akpm; +Cc: linux-kernel, jbarnes, steiner, torvalds

Hi,

Since we now support # of CPUs > BITS_PER_LONG with cpumask_t it would
be nice to be able to support more than BITS_PER_LONG memory blocks.

Patch relative to 2.6.1-mm4.

Cheers,
Jes

--- orig/linux-2.6.1-mm4/include/linux/mmzone.h	Fri Jan 16 01:59:20 2004
+++ linux-2.6.1-mm4/include/linux/mmzone.h	Mon Jan 19 04:44:37 2004
@@ -296,7 +296,7 @@
 					  void *, size_t *);
 
 #ifdef CONFIG_NUMA
-#define MAX_NR_MEMBLKS	BITS_PER_LONG /* Max number of Memory Blocks */
+#define MAX_NR_MEMBLKS	MAX_NUMNODES /* Max number of Memory Blocks */
 #else /* !CONFIG_NUMA */
 #define MAX_NR_MEMBLKS	1
 #endif /* CONFIG_NUMA */



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA
  2004-01-19 13:05 [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA Jes Sorensen
@ 2004-01-19 20:08 ` Martin J. Bligh
  2004-01-19 22:45   ` Jack Steiner
  0 siblings, 1 reply; 11+ messages in thread
From: Martin J. Bligh @ 2004-01-19 20:08 UTC (permalink / raw)
  To: Jes Sorensen, akpm; +Cc: linux-kernel, jbarnes, steiner, torvalds

> Since we now support # of CPUs > BITS_PER_LONG with cpumask_t it would
> be nice to be able to support more than BITS_PER_LONG memory blocks.

Nothing uses them. We're probably better off just removing them altogether.

M.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA
  2004-01-19 20:08 ` Martin J. Bligh
@ 2004-01-19 22:45   ` Jack Steiner
  2004-01-20  2:24     ` Jesse Barnes
  0 siblings, 1 reply; 11+ messages in thread
From: Jack Steiner @ 2004-01-19 22:45 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: Jes Sorensen, akpm, linux-kernel, jbarnes, torvalds

On Mon, Jan 19, 2004 at 12:08:04PM -0800, Martin J. Bligh wrote:
> > Since we now support # of CPUs > BITS_PER_LONG with cpumask_t it would
> > be nice to be able to support more than BITS_PER_LONG memory blocks.
> 
> Nothing uses them. We're probably better off just removing them altogether.

I dont understand.
node_memblk[] is used on IA64 in arch/ia64/mm/discontig.c (& other places too).


-- 
Thanks

Jack Steiner (steiner@sgi.com)          651-683-5302
Principal Engineer                      SGI - Silicon Graphics, Inc.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA
  2004-01-19 22:45   ` Jack Steiner
@ 2004-01-20  2:24     ` Jesse Barnes
  2004-01-20  3:12       ` Jack Steiner
  2004-01-20  5:21       ` Martin J. Bligh
  0 siblings, 2 replies; 11+ messages in thread
From: Jesse Barnes @ 2004-01-20  2:24 UTC (permalink / raw)
  To: Jack Steiner; +Cc: mbligh, jes, linux-kernel

On Mon, Jan 19, 2004 at 04:45:35PM -0600, Jack Steiner wrote:
> On Mon, Jan 19, 2004 at 12:08:04PM -0800, Martin J. Bligh wrote:
> > > Since we now support # of CPUs > BITS_PER_LONG with cpumask_t it would
> > > be nice to be able to support more than BITS_PER_LONG memory blocks.
> > 
> > Nothing uses them. We're probably better off just removing them altogether.
> 
> I dont understand.
> node_memblk[] is used on IA64 in arch/ia64/mm/discontig.c (& other places too).

I think Martin is referring to the memblk_*line() functions and the fact
that memblks are exported via sysfs to userspace.  That API hasn't
proven very useful so far since it's really waiting for memory hot
add/remove.  Of course, we'll still need structures to support that for
the low level arch specific discontig code, so any patch that killed
memblks in sysfs and elsewhere would have to take that into account...
(In particular, node_memblk[] is filled out by the ACPI SRAT parsing
code and use for discontig init and physical->node id conversion.)

Jesse

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA
  2004-01-20  2:24     ` Jesse Barnes
@ 2004-01-20  3:12       ` Jack Steiner
  2004-01-20  6:25         ` Martin J. Bligh
  2004-01-20  5:21       ` Martin J. Bligh
  1 sibling, 1 reply; 11+ messages in thread
From: Jack Steiner @ 2004-01-20  3:12 UTC (permalink / raw)
  To: mbligh, jes, linux-kernel

On Mon, Jan 19, 2004 at 06:24:52PM -0800, Jesse Barnes wrote:
> On Mon, Jan 19, 2004 at 04:45:35PM -0600, Jack Steiner wrote:
> > On Mon, Jan 19, 2004 at 12:08:04PM -0800, Martin J. Bligh wrote:
> > > > Since we now support # of CPUs > BITS_PER_LONG with cpumask_t it would
> > > > be nice to be able to support more than BITS_PER_LONG memory blocks.
> > > 
> > > Nothing uses them. We're probably better off just removing them altogether.
> > 
> > I dont understand.
> > node_memblk[] is used on IA64 in arch/ia64/mm/discontig.c (& other places too).
> 
> I think Martin is referring to the memblk_*line() functions and the fact
> that memblks are exported via sysfs to userspace.  That API hasn't
> proven very useful so far since it's really waiting for memory hot
> add/remove.  Of course, we'll still need structures to support that for
> the low level arch specific discontig code, so any patch that killed
> memblks in sysfs and elsewhere would have to take that into account...
> (In particular, node_memblk[] is filled out by the ACPI SRAT parsing
> code and use for discontig init and physical->node id conversion.)
> 
> Jesse

OK, that makes sense.


BTW, I think SN2 has a brain-dead definition of node_memblk[]. It currently works 
but I think it is incorrect & should probably be fixed before we get into
trouble. 

On SN2, memory blocks that ACTUAL EXIST are described via the EFI tables. 
This EFI table describes memory that is put into the VM tables.

The SRAT tables that are used to build the node_memblks array dont describe
actual memory.  The SRAT (on SN2) describes the way hardware could potentially map 
physical memory to nodes. A memblk entry will cover non-existant memory.

For example.  For one node with max memory (assume 512MB dimms)
	- each node has 4 discontiguous blocks of memory.
	- actual memory on node exists at these node offsets:
	 	0-2GB
		16-18GB
		32-24GB
		48-50GB
	- These ranges are described by the EFI tables
	- the SRAT (& node_memblk) has a SINGLE entry to describe the entire node:
		memblk = 0-64GB 
	  Note that this entry covers non-existent memory


I believe SN2 should use 4 SRAT entries - one entry for each block of memory
that actually exists. 
	 	
-- 
Thanks

Jack Steiner (steiner@sgi.com)          651-683-5302
Principal Engineer                      SGI - Silicon Graphics, Inc.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA
  2004-01-20  2:24     ` Jesse Barnes
  2004-01-20  3:12       ` Jack Steiner
@ 2004-01-20  5:21       ` Martin J. Bligh
  1 sibling, 0 replies; 11+ messages in thread
From: Martin J. Bligh @ 2004-01-20  5:21 UTC (permalink / raw)
  To: Jesse Barnes, Jack Steiner; +Cc: jes, linux-kernel

--Jesse Barnes <jbarnes@sgi.com> wrote (on Monday, January 19, 2004 18:24:52 -0800):

> On Mon, Jan 19, 2004 at 04:45:35PM -0600, Jack Steiner wrote:
>> On Mon, Jan 19, 2004 at 12:08:04PM -0800, Martin J. Bligh wrote:
>> > > Since we now support # of CPUs > BITS_PER_LONG with cpumask_t it would
>> > > be nice to be able to support more than BITS_PER_LONG memory blocks.
>> > 
>> > Nothing uses them. We're probably better off just removing them altogether.
>> 
>> I dont understand.
>> node_memblk[] is used on IA64 in arch/ia64/mm/discontig.c (& other places too).
> 
> I think Martin is referring to the memblk_*line() functions and the fact
> that memblks are exported via sysfs to userspace.  That API hasn't
> proven very useful so far since it's really waiting for memory hot
> add/remove.  Of course, we'll still need structures to support that for
> the low level arch specific discontig code, so any patch that killed
> memblks in sysfs and elsewhere would have to take that into account...
> (In particular, node_memblk[] is filled out by the ACPI SRAT parsing
> code and use for discontig init and physical->node id conversion.)

Phew ;-) 
Maybe I'll go ahead and delete it quickly ... ;-)

M.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA
  2004-01-20  3:12       ` Jack Steiner
@ 2004-01-20  6:25         ` Martin J. Bligh
  2004-01-20 10:59           ` Jes Sorensen
  0 siblings, 1 reply; 11+ messages in thread
From: Martin J. Bligh @ 2004-01-20  6:25 UTC (permalink / raw)
  To: Jack Steiner, jes, linux-kernel; +Cc: Jesse Barnes

[-- Attachment #1: Type: text/plain, Size: 1278 bytes --]

> On Mon, Jan 19, 2004 at 06:24:52PM -0800, Jesse Barnes wrote:
>> On Mon, Jan 19, 2004 at 04:45:35PM -0600, Jack Steiner wrote:
>> > On Mon, Jan 19, 2004 at 12:08:04PM -0800, Martin J. Bligh wrote:
>> > > > Since we now support # of CPUs > BITS_PER_LONG with cpumask_t it would
>> > > > be nice to be able to support more than BITS_PER_LONG memory blocks.
>> > > 
>> > > Nothing uses them. We're probably better off just removing them altogether.
>> > 
>> > I dont understand.
>> > node_memblk[] is used on IA64 in arch/ia64/mm/discontig.c (& other places too).
>> 
>> I think Martin is referring to the memblk_*line() functions and the fact
>> that memblks are exported via sysfs to userspace.  That API hasn't
>> proven very useful so far since it's really waiting for memory hot
>> add/remove.  Of course, we'll still need structures to support that for
>> the low level arch specific discontig code, so any patch that killed
>> memblks in sysfs and elsewhere would have to take that into account...
>> (In particular, node_memblk[] is filled out by the ACPI SRAT parsing
>> code and use for discontig init and physical->node id conversion.)
>> 
>> Jesse
> 
> OK, that makes sense.

Could one of you test this patch for me? Probably just a build would do fine.

Thanks,

M.

[-- Attachment #2: no_memblk --]
[-- Type: application/octet-stream, Size: 14724 bytes --]

diff -aurpN -X /home/fletch/.diff.exclude virgin/arch/i386/mach-default/topology.c no_memblk/arch/i386/mach-default/topology.c
--- virgin/arch/i386/mach-default/topology.c	Mon Dec 23 23:01:45 2002
+++ no_memblk/arch/i386/mach-default/topology.c	Mon Jan 19 21:46:00 2004
@@ -34,10 +34,8 @@ struct i386_cpu cpu_devices[NR_CPUS];
 #ifdef CONFIG_NUMA
 #include <linux/mmzone.h>
 #include <asm/node.h>
-#include <asm/memblk.h>
 
 struct i386_node node_devices[MAX_NUMNODES];
-struct i386_memblk memblk_devices[MAX_NR_MEMBLKS];
 
 static int __init topology_init(void)
 {
@@ -47,8 +45,6 @@ static int __init topology_init(void)
 		arch_register_node(i);
 	for (i = 0; i < NR_CPUS; i++)
 		if (cpu_possible(i)) arch_register_cpu(i);
-	for (i = 0; i < num_online_memblks(); i++)
-		arch_register_memblk(i);
 	return 0;
 }
 
diff -aurpN -X /home/fletch/.diff.exclude virgin/arch/i386/mach-es7000/topology.c no_memblk/arch/i386/mach-es7000/topology.c
--- virgin/arch/i386/mach-es7000/topology.c	Tue Jun 17 20:58:51 2003
+++ no_memblk/arch/i386/mach-es7000/topology.c	Mon Jan 19 21:46:32 2004
@@ -34,10 +34,8 @@ struct i386_cpu cpu_devices[NR_CPUS];
 #ifdef CONFIG_NUMA
 #include <linux/mmzone.h>
 #include <asm/node.h>
-#include <asm/memblk.h>
 
 struct i386_node node_devices[MAX_NUMNODES];
-struct i386_memblk memblk_devices[MAX_NR_MEMBLKS];
 
 static int __init topology_init(void)
 {
@@ -47,8 +45,6 @@ static int __init topology_init(void)
 		arch_register_node(i);
 	for (i = 0; i < NR_CPUS; i++)
 		if (cpu_possible(i)) arch_register_cpu(i);
-	for (i = 0; i < num_online_memblks(); i++)
-		arch_register_memblk(i);
 	return 0;
 }
 
diff -aurpN -X /home/fletch/.diff.exclude virgin/arch/ia64/mm/numa.c no_memblk/arch/ia64/mm/numa.c
--- virgin/arch/ia64/mm/numa.c	Mon Nov 17 18:29:48 2003
+++ no_memblk/arch/ia64/mm/numa.c	Mon Jan 19 21:56:06 2004
@@ -13,14 +13,12 @@
 #include <linux/config.h>
 #include <linux/cpu.h>
 #include <linux/kernel.h>
-#include <linux/memblk.h>
 #include <linux/mm.h>
 #include <linux/node.h>
 #include <linux/init.h>
 #include <linux/bootmem.h>
 #include <asm/numa.h>
 
-static struct memblk *sysfs_memblks;
 static struct node *sysfs_nodes;
 static struct cpu *sysfs_cpus;
 
@@ -62,18 +60,8 @@ static int __init topology_init(void)
 	}
 	memset(sysfs_nodes, 0, sizeof(struct node) * numnodes);
 
-	sysfs_memblks = kmalloc(sizeof(struct memblk) * num_memblks,
-				GFP_KERNEL);
-	if (!sysfs_memblks) {
-		kfree(sysfs_nodes);
-		err = -ENOMEM;
-		goto out;
-	}
-	memset(sysfs_memblks, 0, sizeof(struct memblk) * num_memblks);
-
 	sysfs_cpus = kmalloc(sizeof(struct cpu) * NR_CPUS, GFP_KERNEL);
 	if (!sysfs_cpus) {
-		kfree(sysfs_memblks);
 		kfree(sysfs_nodes);
 		err = -ENOMEM;
 		goto out;
@@ -82,11 +70,6 @@ static int __init topology_init(void)
 
 	for (i = 0; i < numnodes; i++)
 		if ((err = register_node(&sysfs_nodes[i], i, 0)))
-			goto out;
-
-	for (i = 0; i < num_memblks; i++)
-		if ((err = register_memblk(&sysfs_memblks[i], i,
-					   &sysfs_nodes[memblk_to_node(i)])))
 			goto out;
 
 	for (i = 0; i < NR_CPUS; i++)
diff -aurpN -X /home/fletch/.diff.exclude virgin/drivers/base/Makefile no_memblk/drivers/base/Makefile
--- virgin/drivers/base/Makefile	Tue Sep  2 09:55:44 2003
+++ no_memblk/drivers/base/Makefile	Mon Jan 19 21:56:35 2004
@@ -5,4 +5,4 @@ obj-y			:= core.o sys.o interface.o bus.
 			   cpu.o firmware.o init.o map.o
 obj-y			+= power/
 obj-$(CONFIG_FW_LOADER)	+= firmware_class.o
-obj-$(CONFIG_NUMA)	+= node.o  memblk.o
+obj-$(CONFIG_NUMA)	+= node.o
diff -aurpN -X /home/fletch/.diff.exclude virgin/drivers/base/memblk.c no_memblk/drivers/base/memblk.c
--- virgin/drivers/base/memblk.c	Mon Nov 17 18:28:10 2003
+++ no_memblk/drivers/base/memblk.c	Wed Dec 31 16:00:00 1969
@@ -1,43 +0,0 @@
-/*
- * drivers/base/memblk.c - basic Memory Block class support
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/memblk.h>
-#include <linux/node.h>
-#include <linux/topology.h>
-
-
-static struct sysdev_class memblk_class = {
-	set_kset_name("memblk"),
-};
-
-/*
- * register_memblk - Setup a driverfs device for a MemBlk
- * @num - MemBlk number to use when creating the device.
- *
- * Initialize and register the MemBlk device.
- */
-int __init register_memblk(struct memblk *memblk, int num, struct node *root)
-{
-	int error;
-
-	memblk->node_id = memblk_to_node(num);
-	memblk->sysdev.cls = &memblk_class,
-	memblk->sysdev.id = num;
-
-	error = sys_device_register(&memblk->sysdev);
-	if (!error) 
-		error = sysfs_create_link(&root->sysdev.kobj,
-					  &memblk->sysdev.kobj,
-					  kobject_name(&memblk->sysdev.kobj));
-	return error;
-}
-
-
-int __init register_memblk_type(void)
-{
-	return sysdev_class_register(&memblk_class);
-}
-postcore_initcall(register_memblk_type);
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/asm-alpha/topology.h no_memblk/include/asm-alpha/topology.h
--- virgin/include/asm-alpha/topology.h	Thu Feb 13 11:08:13 2003
+++ no_memblk/include/asm-alpha/topology.h	Mon Jan 19 21:58:36 2004
@@ -40,9 +40,6 @@ static inline int node_to_cpumask(int no
 	return node_cpu_mask;
 }
 
-# define node_to_memblk(node)		(node)
-# define memblk_to_node(memblk)	(memblk)
-
 /* Cross-node load balancing interval. */
 # define NODE_BALANCE_RATE 10
 
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/asm-generic/topology.h no_memblk/include/asm-generic/topology.h
--- virgin/include/asm-generic/topology.h	Wed Mar  5 07:37:06 2003
+++ no_memblk/include/asm-generic/topology.h	Mon Jan 19 21:56:59 2004
@@ -32,9 +32,6 @@
 #ifndef cpu_to_node
 #define cpu_to_node(cpu)	(0)
 #endif
-#ifndef memblk_to_node
-#define memblk_to_node(memblk)	(0)
-#endif
 #ifndef parent_node
 #define parent_node(node)	(0)
 #endif
@@ -43,9 +40,6 @@
 #endif
 #ifndef node_to_first_cpu
 #define node_to_first_cpu(node)	(0)
-#endif
-#ifndef node_to_memblk
-#define node_to_memblk(node)	(0)
 #endif
 #ifndef pcibus_to_cpumask
 #define pcibus_to_cpumask(bus)	(cpu_online_map)
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/asm-i386/memblk.h no_memblk/include/asm-i386/memblk.h
--- virgin/include/asm-i386/memblk.h	Sat Jun 14 18:37:35 2003
+++ no_memblk/include/asm-i386/memblk.h	Wed Dec 31 16:00:00 1969
@@ -1,23 +0,0 @@
-#ifndef _ASM_I386_MEMBLK_H_
-#define _ASM_I386_MEMBLK_H_
-
-#include <linux/device.h>
-#include <linux/mmzone.h>
-#include <linux/memblk.h>
-#include <linux/topology.h>
-
-#include <asm/node.h>
-
-struct i386_memblk {
-	struct memblk memblk;
-};
-extern struct i386_memblk memblk_devices[MAX_NR_MEMBLKS];
-
-static inline int arch_register_memblk(int num){
-	int p_node = memblk_to_node(num);
-
-	return register_memblk(&memblk_devices[num].memblk, num, 
-				&node_devices[p_node].node);
-}
-
-#endif /* _ASM_I386_MEMBLK_H_ */
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/asm-i386/topology.h no_memblk/include/asm-i386/topology.h
--- virgin/include/asm-i386/topology.h	Tue Sep  2 09:55:53 2003
+++ no_memblk/include/asm-i386/topology.h	Mon Jan 19 21:58:56 2004
@@ -43,9 +43,6 @@ static inline int cpu_to_node(int cpu)
 	return cpu_2_node[cpu];
 }
 
-/* Returns the number of the node containing MemBlk 'memblk' */
-#define memblk_to_node(memblk) (memblk)
-
 /* Returns the number of the node containing Node 'node'.  This architecture is flat, 
    so it is a pretty simple function! */
 #define parent_node(node) (node)
@@ -62,9 +59,6 @@ static inline int node_to_first_cpu(int 
 	cpumask_t mask = node_to_cpumask(node);
 	return first_cpu(mask);
 }
-
-/* Returns the number of the first MemBlk on Node 'node' */
-#define node_to_memblk(node) (node)
 
 /* Returns the number of the node containing PCI bus 'bus' */
 static inline cpumask_t pcibus_to_cpumask(int bus)
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/asm-ia64/mmzone.h no_memblk/include/asm-ia64/mmzone.h
--- virgin/include/asm-ia64/mmzone.h	Mon Nov 17 18:29:43 2003
+++ no_memblk/include/asm-ia64/mmzone.h	Mon Jan 19 21:58:00 2004
@@ -20,11 +20,9 @@
 #ifdef CONFIG_IA64_DIG /* DIG systems are small */
 # define MAX_PHYSNODE_ID	8
 # define NR_NODES		8
-# define NR_MEMBLKS		(NR_NODES * 32)
 #else /* sn2 is the biggest case, so we use that if !DIG */
 # define MAX_PHYSNODE_ID	2048
 # define NR_NODES		256
-# define NR_MEMBLKS		(NR_NODES)
 #endif
 
 extern unsigned long max_low_pfn;
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/asm-ia64/topology.h no_memblk/include/asm-ia64/topology.h
--- virgin/include/asm-ia64/topology.h	Wed Jul  2 21:59:12 2003
+++ no_memblk/include/asm-ia64/topology.h	Mon Jan 19 21:53:00 2004
@@ -29,15 +29,6 @@
 #define node_to_cpumask(node) (node_to_cpu_mask[node])
 
 /*
- * Returns the number of the node containing MemBlk 'memblk'
- */
-#ifdef CONFIG_ACPI_NUMA
-#define memblk_to_node(memblk) (node_memblk[memblk].nid)
-#else
-#define memblk_to_node(memblk) (memblk)
-#endif
-
-/*
  * Returns the number of the node containing Node 'nid'.
  * Not implemented here. Multi-level hierarchies detected with
  * the help of node_distance().
@@ -48,12 +39,6 @@
  * Returns the number of the first CPU on Node 'node'.
  */
 #define node_to_first_cpu(node) (__ffs(node_to_cpumask(node)))
-
-/*
- * Returns the number of the first MemBlk on Node 'node'
- * Should be fixed when IA64 discontigmem goes in.
- */
-#define node_to_memblk(node) (node)
 
 /* Cross-node load balancing interval. */
 #define NODE_BALANCE_RATE 10
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/asm-ppc64/topology.h no_memblk/include/asm-ppc64/topology.h
--- virgin/include/asm-ppc64/topology.h	Mon Nov 17 18:28:58 2003
+++ no_memblk/include/asm-ppc64/topology.h	Mon Jan 19 21:50:40 2004
@@ -20,8 +20,6 @@ static inline int cpu_to_node(int cpu)
 	return node;
 }
 
-#define memblk_to_node(memblk)	(memblk)
-
 #define parent_node(node)	(node)
 
 static inline cpumask_t node_to_cpumask(int node)
@@ -35,8 +33,6 @@ static inline int node_to_first_cpu(int 
 	tmp = node_to_cpumask(node);
 	return first_cpu(tmp);
 }
-
-#define node_to_memblk(node)	(node)
 
 #define pcibus_to_cpumask(bus)	(cpu_online_map)
 
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/asm-x86_64/topology.h no_memblk/include/asm-x86_64/topology.h
--- virgin/include/asm-x86_64/topology.h	Mon Dec  8 09:55:53 2003
+++ no_memblk/include/asm-x86_64/topology.h	Mon Jan 19 21:58:18 2004
@@ -15,11 +15,9 @@ extern int fake_node;
 extern unsigned long cpu_online_map;
 
 #define cpu_to_node(cpu)		(fake_node ? 0 : (cpu))
-#define memblk_to_node(memblk) 	(fake_node ? 0 : (memblk))
 #define parent_node(node)		(node)
 #define node_to_first_cpu(node) 	(fake_node ? 0 : (node))
 #define node_to_cpumask(node)	(fake_node ? cpu_online_map : (1UL << (node)))
-#define node_to_memblk(node)		(node)
 
 static inline unsigned long pcibus_to_cpumask(int bus)
 {
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/linux/memblk.h no_memblk/include/linux/memblk.h
--- virgin/include/linux/memblk.h	Sun Nov 17 20:29:56 2002
+++ no_memblk/include/linux/memblk.h	Wed Dec 31 16:00:00 1969
@@ -1,32 +0,0 @@
-/*
- * include/linux/memblk.h - generic memblk definition
- *
- * This is mainly for topological representation. We define the 
- * basic 'struct memblk' here, which can be embedded in per-arch 
- * definitions of memory blocks.
- *
- * Basic handling of the devices is done in drivers/base/memblk.c
- * and system devices are handled in drivers/base/sys.c. 
- *
- * MemBlks are exported via driverfs in the class/memblk/devices/
- * directory. 
- *
- * Per-memblk interfaces can be implemented using a struct device_interface. 
- * See the following for how to do this: 
- * - drivers/base/intf.c 
- * - Documentation/driver-model/interface.txt
- */
-#ifndef _LINUX_MEMBLK_H_
-#define _LINUX_MEMBLK_H_
-
-#include <linux/device.h>
-#include <linux/node.h>
-
-struct memblk {
-	int node_id;		/* The node which contains the MemBlk */
-	struct sys_device sysdev;
-};
-
-extern int register_memblk(struct memblk *, int, struct node *);
-
-#endif /* _LINUX_MEMBLK_H_ */
diff -aurpN -X /home/fletch/.diff.exclude virgin/include/linux/mmzone.h no_memblk/include/linux/mmzone.h
--- virgin/include/linux/mmzone.h	Fri Jan  9 17:40:08 2004
+++ no_memblk/include/linux/mmzone.h	Mon Jan 19 21:49:33 2004
@@ -288,12 +288,6 @@ struct file;
 int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *, 
 					  void *, size_t *);
 
-#ifdef CONFIG_NUMA
-#define MAX_NR_MEMBLKS	BITS_PER_LONG /* Max number of Memory Blocks */
-#else /* !CONFIG_NUMA */
-#define MAX_NR_MEMBLKS	1
-#endif /* CONFIG_NUMA */
-
 #include <linux/topology.h>
 /* Returns the number of the current Node. */
 #define numa_node_id()		(cpu_to_node(smp_processor_id()))
@@ -329,7 +323,6 @@ extern struct pglist_data contig_page_da
 #endif
 
 extern DECLARE_BITMAP(node_online_map, MAX_NUMNODES);
-extern DECLARE_BITMAP(memblk_online_map, MAX_NR_MEMBLKS);
 
 #if defined(CONFIG_DISCONTIGMEM) || defined(CONFIG_NUMA)
 
@@ -347,20 +340,6 @@ static inline unsigned int num_online_no
 	return num;
 }
 
-#define memblk_online(memblk)		test_bit(memblk, memblk_online_map)
-#define memblk_set_online(memblk)	set_bit(memblk, memblk_online_map)
-#define memblk_set_offline(memblk)	clear_bit(memblk, memblk_online_map)
-static inline unsigned int num_online_memblks(void)
-{
-	int i, num = 0;
-
-	for(i = 0; i < MAX_NR_MEMBLKS; i++){
-		if (memblk_online(i))
-			num++;
-	}
-	return num;
-}
-
 #else /* !CONFIG_DISCONTIGMEM && !CONFIG_NUMA */
 
 #define node_online(node) \
@@ -370,14 +349,6 @@ static inline unsigned int num_online_me
 #define node_set_offline(node) \
 	({ BUG_ON((node) != 0); clear_bit(node, node_online_map); })
 #define num_online_nodes()	1
-
-#define memblk_online(memblk) \
-	({ BUG_ON((memblk) != 0); test_bit(memblk, memblk_online_map); })
-#define memblk_set_online(memblk) \
-	({ BUG_ON((memblk) != 0); set_bit(memblk, memblk_online_map); })
-#define memblk_set_offline(memblk) \
-	({ BUG_ON((memblk) != 0); clear_bit(memblk, memblk_online_map); })
-#define num_online_memblks()		1
 
 #endif /* CONFIG_DISCONTIGMEM || CONFIG_NUMA */
 #endif /* !__ASSEMBLY__ */
diff -aurpN -X /home/fletch/.diff.exclude virgin/mm/page_alloc.c no_memblk/mm/page_alloc.c
--- virgin/mm/page_alloc.c	Fri Jan  9 17:40:10 2004
+++ no_memblk/mm/page_alloc.c	Mon Jan 19 21:59:26 2004
@@ -35,7 +35,6 @@
 #include <asm/tlbflush.h>
 
 DECLARE_BITMAP(node_online_map, MAX_NUMNODES);
-DECLARE_BITMAP(memblk_online_map, MAX_NR_MEMBLKS);
 struct pglist_data *pgdat_list;
 unsigned long totalram_pages;
 unsigned long totalhigh_pages;
@@ -1390,7 +1389,6 @@ void __init free_area_init_node(int nid,
 	pgdat->node_mem_map = node_mem_map;
 
 	free_area_init_core(pgdat, zones_size, zholes_size);
-	memblk_set_online(node_to_memblk(nid));
 
 	calculate_zone_bitmap(pgdat, zones_size);
 }

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA
  2004-01-20  6:25         ` Martin J. Bligh
@ 2004-01-20 10:59           ` Jes Sorensen
  2004-01-20 16:11             ` Martin J. Bligh
  0 siblings, 1 reply; 11+ messages in thread
From: Jes Sorensen @ 2004-01-20 10:59 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: Jack Steiner, linux-kernel, Jesse Barnes

>>>>> "Martin" == Martin J Bligh <mbligh@aracnet.com> writes:

>> On Mon, Jan 19, 2004 at 06:24:52PM -0800, Jesse Barnes wrote:
>>> I think Martin is referring to the memblk_*line() functions and
>>> the fact that memblks are exported via sysfs to userspace.  That
>>> API hasn't proven very useful so far since it's really waiting for
>>> memory hot add/remove.  Of course, we'll still need structures to
>>> support that for the low level arch specific discontig code, so
>>> any patch that killed memblks in sysfs and elsewhere would have to
>>> take that into account...  (In particular, node_memblk[] is filled
>>> out by the ACPI SRAT parsing code and use for discontig init and
>>> physical->node id conversion.)
>>> 
>>> Jesse
>>  OK, that makes sense.

Martin> Could one of you test this patch for me? Probably just a build
Martin> would do fine.

Martin,

Tried it, no go! It conflicts with arch/ia64/mm/numa.c and
arch/ia64/mm,/discontig.c as Jack had suggested.

Cheers,
Jes

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA
  2004-01-20 10:59           ` Jes Sorensen
@ 2004-01-20 16:11             ` Martin J. Bligh
  2004-01-22 15:24               ` Jes Sorensen
  0 siblings, 1 reply; 11+ messages in thread
From: Martin J. Bligh @ 2004-01-20 16:11 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Jack Steiner, linux-kernel, Jesse Barnes

>>>>>> "Martin" == Martin J Bligh <mbligh@aracnet.com> writes:
> 
>>> On Mon, Jan 19, 2004 at 06:24:52PM -0800, Jesse Barnes wrote:
>>>> I think Martin is referring to the memblk_*line() functions and
>>>> the fact that memblks are exported via sysfs to userspace.  That
>>>> API hasn't proven very useful so far since it's really waiting for
>>>> memory hot add/remove.  Of course, we'll still need structures to
>>>> support that for the low level arch specific discontig code, so
>>>> any patch that killed memblks in sysfs and elsewhere would have to
>>>> take that into account...  (In particular, node_memblk[] is filled
>>>> out by the ACPI SRAT parsing code and use for discontig init and
>>>> physical->node id conversion.)
>>>> 
>>>> Jesse
>>>  OK, that makes sense.
> 
> Martin> Could one of you test this patch for me? Probably just a build
> Martin> would do fine.
> 
> Martin,
> 
> Tried it, no go! It conflicts with arch/ia64/mm/numa.c and
> arch/ia64/mm,/discontig.c as Jack had suggested.

Can you send me the build output? It shouldn't conflict ... there are two
separate uses of the term "memblk" by the looks of it.

M.


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA
  2004-01-20 16:11             ` Martin J. Bligh
@ 2004-01-22 15:24               ` Jes Sorensen
  2004-01-23  6:09                 ` Martin J. Bligh
  0 siblings, 1 reply; 11+ messages in thread
From: Jes Sorensen @ 2004-01-22 15:24 UTC (permalink / raw)
  To: Martin J. Bligh; +Cc: Jack Steiner, linux-kernel, Jesse Barnes

>>>>> "Martin" == Martin J Bligh <mbligh@aracnet.com> writes:

>>  Martin,
>> 
>> Tried it, no go! It conflicts with arch/ia64/mm/numa.c and
>> arch/ia64/mm,/discontig.c as Jack had suggested.

Martin> Can you send me the build output? It shouldn't conflict
Martin> ... there are two separate uses of the term "memblk" by the
Martin> looks of it.

Ok,

This version boots, it seems we had to different uses of NR_MEMBLK in
the kernel, I renamed one of them to NR_NODE_MEMBLK and it works.

Cheers,
Jes

diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/arch/i386/mach-default/topology.c linux-2.6.2-rc1/arch/i386/mach-default/topology.c
--- orig/linux-2.6.2-rc1/arch/i386/mach-default/topology.c	Tue Jan 20 19:50:30 2004
+++ linux-2.6.2-rc1/arch/i386/mach-default/topology.c	Thu Jan 22 06:27:04 2004
@@ -34,10 +34,8 @@
 #ifdef CONFIG_NUMA
 #include <linux/mmzone.h>
 #include <asm/node.h>
-#include <asm/memblk.h>
 
 struct i386_node node_devices[MAX_NUMNODES];
-struct i386_memblk memblk_devices[MAX_NR_MEMBLKS];
 
 static int __init topology_init(void)
 {
@@ -47,8 +45,6 @@
 		arch_register_node(i);
 	for (i = 0; i < NR_CPUS; i++)
 		if (cpu_possible(i)) arch_register_cpu(i);
-	for (i = 0; i < num_online_memblks(); i++)
-		arch_register_memblk(i);
 	return 0;
 }
 
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/arch/i386/mach-es7000/topology.c linux-2.6.2-rc1/arch/i386/mach-es7000/topology.c
--- orig/linux-2.6.2-rc1/arch/i386/mach-es7000/topology.c	Tue Jan 20 19:50:32 2004
+++ linux-2.6.2-rc1/arch/i386/mach-es7000/topology.c	Thu Jan 22 06:27:04 2004
@@ -34,10 +34,8 @@
 #ifdef CONFIG_NUMA
 #include <linux/mmzone.h>
 #include <asm/node.h>
-#include <asm/memblk.h>
 
 struct i386_node node_devices[MAX_NUMNODES];
-struct i386_memblk memblk_devices[MAX_NR_MEMBLKS];
 
 static int __init topology_init(void)
 {
@@ -47,8 +45,6 @@
 		arch_register_node(i);
 	for (i = 0; i < NR_CPUS; i++)
 		if (cpu_possible(i)) arch_register_cpu(i);
-	for (i = 0; i < num_online_memblks(); i++)
-		arch_register_memblk(i);
 	return 0;
 }
 
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/arch/ia64/kernel/acpi.c linux-2.6.2-rc1/arch/ia64/kernel/acpi.c
--- orig/linux-2.6.2-rc1/arch/ia64/kernel/acpi.c	Tue Jan 20 19:49:59 2004
+++ linux-2.6.2-rc1/arch/ia64/kernel/acpi.c	Thu Jan 22 07:19:58 2004
@@ -395,7 +395,7 @@
 	size = ma->length_hi;
 	size = (size << 32) | ma->length_lo;
 
-	if (num_memblks >= NR_MEMBLKS) {
+	if (num_node_memblks >= NR_NODE_MEMBLKS) {
 		printk(KERN_ERR "Too many mem chunks in SRAT. Ignoring %ld MBytes at %lx\n",
 		       size/(1024*1024), paddr);
 		return;
@@ -409,7 +409,7 @@
 	pxm_bit_set(pxm);
 
 	/* Insertion sort based on base address */
-	pend = &node_memblk[num_memblks];
+	pend = &node_memblk[num_node_memblks];
 	for (p = &node_memblk[0]; p < pend; p++) {
 		if (paddr < p->start_paddr)
 			break;
@@ -421,7 +421,7 @@
 	p->start_paddr = paddr;
 	p->size = size;
 	p->nid = pxm;
-	num_memblks++;
+	num_node_memblks++;
 }
 
 void __init
@@ -448,7 +448,7 @@
 	}
 
 	/* set logical node id in memory chunk structure */
-	for (i = 0; i < num_memblks; i++)
+	for (i = 0; i < num_node_memblks; i++)
 		node_memblk[i].nid = pxm_to_nid_map[node_memblk[i].nid];
 
 	/* assign memory bank numbers for each chunk on each node */
@@ -456,7 +456,7 @@
 		int bank;
 
 		bank = 0;
-		for (j = 0; j < num_memblks; j++)
+		for (j = 0; j < num_node_memblks; j++)
 			if (node_memblk[j].nid == i)
 				node_memblk[j].bank = bank++;
 	}
@@ -466,7 +466,7 @@
 		node_cpuid[i].nid = pxm_to_nid_map[node_cpuid[i].nid];
 
 	printk(KERN_INFO "Number of logical nodes in system = %d\n", numnodes);
-	printk(KERN_INFO "Number of memory chunks in system = %d\n", num_memblks);
+	printk(KERN_INFO "Number of memory chunks in system = %d\n", num_node_memblks);
 
 	if (!slit_table) return;
 	memset(numa_slit, -1, sizeof(numa_slit));
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/arch/ia64/mm/discontig.c linux-2.6.2-rc1/arch/ia64/mm/discontig.c
--- orig/linux-2.6.2-rc1/arch/ia64/mm/discontig.c	Tue Jan 20 19:50:31 2004
+++ linux-2.6.2-rc1/arch/ia64/mm/discontig.c	Thu Jan 22 06:47:33 2004
@@ -419,14 +419,14 @@
 
 	func = arg;
 
-	if (!num_memblks) {
-		/* No SRAT table, to assume one node (node 0) */
+	if (!num_node_memblks) {
+		/* No SRAT table, so assume one node (node 0) */
 		if (start < end)
 			(*func)(start, len, 0);
 		return;
 	}
 
-	for (i = 0; i < num_memblks; i++) {
+	for (i = 0; i < num_node_memblks; i++) {
 		rs = max(start, node_memblk[i].start_paddr);
 		re = min(end, node_memblk[i].start_paddr +
 			 node_memblk[i].size);
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/arch/ia64/mm/numa.c linux-2.6.2-rc1/arch/ia64/mm/numa.c
--- orig/linux-2.6.2-rc1/arch/ia64/mm/numa.c	Tue Jan 20 19:49:36 2004
+++ linux-2.6.2-rc1/arch/ia64/mm/numa.c	Thu Jan 22 06:34:46 2004
@@ -13,7 +13,6 @@
 #include <linux/config.h>
 #include <linux/cpu.h>
 #include <linux/kernel.h>
-#include <linux/memblk.h>
 #include <linux/mm.h>
 #include <linux/node.h>
 #include <linux/init.h>
@@ -21,7 +20,6 @@
 #include <asm/mmzone.h>
 #include <asm/numa.h>
 
-static struct memblk *sysfs_memblks;
 static struct node *sysfs_nodes;
 static struct cpu *sysfs_cpus;
 
@@ -29,8 +27,8 @@
  * The following structures are usually initialized by ACPI or
  * similar mechanisms and describe the NUMA characteristics of the machine.
  */
-int num_memblks;
-struct node_memblk_s node_memblk[NR_MEMBLKS];
+int num_node_memblks;
+struct node_memblk_s node_memblk[NR_NODE_MEMBLKS];
 struct node_cpuid_s node_cpuid[NR_CPUS];
 /*
  * This is a matrix with "distances" between nodes, they should be
@@ -44,12 +42,12 @@
 {
 	int	i;
 
-	for (i = 0; i < num_memblks; i++)
+	for (i = 0; i < num_node_memblks; i++)
 		if (paddr >= node_memblk[i].start_paddr &&
 		    paddr < node_memblk[i].start_paddr + node_memblk[i].size)
 			break;
 
-	return (i < num_memblks) ? node_memblk[i].nid : (num_memblks ? -1 : 0);
+	return (i < num_node_memblks) ? node_memblk[i].nid : (num_node_memblks ? -1 : 0);
 }
 
 static int __init topology_init(void)
@@ -63,18 +61,8 @@
 	}
 	memset(sysfs_nodes, 0, sizeof(struct node) * numnodes);
 
-	sysfs_memblks = kmalloc(sizeof(struct memblk) * num_memblks,
-				GFP_KERNEL);
-	if (!sysfs_memblks) {
-		kfree(sysfs_nodes);
-		err = -ENOMEM;
-		goto out;
-	}
-	memset(sysfs_memblks, 0, sizeof(struct memblk) * num_memblks);
-
 	sysfs_cpus = kmalloc(sizeof(struct cpu) * NR_CPUS, GFP_KERNEL);
 	if (!sysfs_cpus) {
-		kfree(sysfs_memblks);
 		kfree(sysfs_nodes);
 		err = -ENOMEM;
 		goto out;
@@ -85,11 +73,6 @@
 		if ((err = register_node(&sysfs_nodes[i], i, 0)))
 			goto out;
 
-	for (i = 0; i < num_memblks; i++)
-		if ((err = register_memblk(&sysfs_memblks[i], i,
-					   &sysfs_nodes[memblk_to_node(i)])))
-			goto out;
-
 	for (i = 0; i < NR_CPUS; i++)
 		if (cpu_online(i))
 			if((err = register_cpu(&sysfs_cpus[i], i,
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/drivers/base/Makefile linux-2.6.2-rc1/drivers/base/Makefile
--- orig/linux-2.6.2-rc1/drivers/base/Makefile	Tue Jan 20 19:50:30 2004
+++ linux-2.6.2-rc1/drivers/base/Makefile	Thu Jan 22 06:27:04 2004
@@ -5,4 +5,4 @@
 			   cpu.o firmware.o init.o map.o
 obj-y			+= power/
 obj-$(CONFIG_FW_LOADER)	+= firmware_class.o
-obj-$(CONFIG_NUMA)	+= node.o  memblk.o
+obj-$(CONFIG_NUMA)	+= node.o
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/drivers/base/memblk.c linux-2.6.2-rc1/drivers/base/memblk.c
--- orig/linux-2.6.2-rc1/drivers/base/memblk.c	Tue Jan 20 19:50:42 2004
+++ linux-2.6.2-rc1/drivers/base/memblk.c	Wed Dec 31 16:00:00 1969
@@ -1,43 +0,0 @@
-/*
- * drivers/base/memblk.c - basic Memory Block class support
- */
-
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/memblk.h>
-#include <linux/node.h>
-#include <linux/topology.h>
-
-
-static struct sysdev_class memblk_class = {
-	set_kset_name("memblk"),
-};
-
-/*
- * register_memblk - Setup a driverfs device for a MemBlk
- * @num - MemBlk number to use when creating the device.
- *
- * Initialize and register the MemBlk device.
- */
-int __init register_memblk(struct memblk *memblk, int num, struct node *root)
-{
-	int error;
-
-	memblk->node_id = memblk_to_node(num);
-	memblk->sysdev.cls = &memblk_class,
-	memblk->sysdev.id = num;
-
-	error = sys_device_register(&memblk->sysdev);
-	if (!error) 
-		error = sysfs_create_link(&root->sysdev.kobj,
-					  &memblk->sysdev.kobj,
-					  kobject_name(&memblk->sysdev.kobj));
-	return error;
-}
-
-
-int __init register_memblk_type(void)
-{
-	return sysdev_class_register(&memblk_class);
-}
-postcore_initcall(register_memblk_type);
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/include/asm-alpha/topology.h linux-2.6.2-rc1/include/asm-alpha/topology.h
--- orig/linux-2.6.2-rc1/include/asm-alpha/topology.h	Tue Jan 20 19:49:36 2004
+++ linux-2.6.2-rc1/include/asm-alpha/topology.h	Thu Jan 22 06:27:04 2004
@@ -39,9 +39,6 @@
 	return node_cpu_mask;
 }
 
-# define node_to_memblk(node)		(node)
-# define memblk_to_node(memblk)	(memblk)
-
 /* Cross-node load balancing interval. */
 # define NODE_BALANCE_RATE 10
 
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/include/asm-generic/topology.h linux-2.6.2-rc1/include/asm-generic/topology.h
--- orig/linux-2.6.2-rc1/include/asm-generic/topology.h	Tue Jan 20 19:49:22 2004
+++ linux-2.6.2-rc1/include/asm-generic/topology.h	Thu Jan 22 06:27:04 2004
@@ -32,9 +32,6 @@
 #ifndef cpu_to_node
 #define cpu_to_node(cpu)	(0)
 #endif
-#ifndef memblk_to_node
-#define memblk_to_node(memblk)	(0)
-#endif
 #ifndef parent_node
 #define parent_node(node)	(0)
 #endif
@@ -44,9 +41,6 @@
 #ifndef node_to_first_cpu
 #define node_to_first_cpu(node)	(0)
 #endif
-#ifndef node_to_memblk
-#define node_to_memblk(node)	(0)
-#endif
 #ifndef pcibus_to_cpumask
 #define pcibus_to_cpumask(bus)	(cpu_online_map)
 #endif
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/include/asm-i386/memblk.h linux-2.6.2-rc1/include/asm-i386/memblk.h
--- orig/linux-2.6.2-rc1/include/asm-i386/memblk.h	Tue Jan 20 19:50:03 2004
+++ linux-2.6.2-rc1/include/asm-i386/memblk.h	Wed Dec 31 16:00:00 1969
@@ -1,23 +0,0 @@
-#ifndef _ASM_I386_MEMBLK_H_
-#define _ASM_I386_MEMBLK_H_
-
-#include <linux/device.h>
-#include <linux/mmzone.h>
-#include <linux/memblk.h>
-#include <linux/topology.h>
-
-#include <asm/node.h>
-
-struct i386_memblk {
-	struct memblk memblk;
-};
-extern struct i386_memblk memblk_devices[MAX_NR_MEMBLKS];
-
-static inline int arch_register_memblk(int num){
-	int p_node = memblk_to_node(num);
-
-	return register_memblk(&memblk_devices[num].memblk, num, 
-				&node_devices[p_node].node);
-}
-
-#endif /* _ASM_I386_MEMBLK_H_ */
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/include/asm-i386/topology.h linux-2.6.2-rc1/include/asm-i386/topology.h
--- orig/linux-2.6.2-rc1/include/asm-i386/topology.h	Tue Jan 20 19:49:28 2004
+++ linux-2.6.2-rc1/include/asm-i386/topology.h	Thu Jan 22 06:27:04 2004
@@ -43,9 +43,6 @@
 	return cpu_2_node[cpu];
 }
 
-/* Returns the number of the node containing MemBlk 'memblk' */
-#define memblk_to_node(memblk) (memblk)
-
 /* Returns the number of the node containing Node 'node'.  This architecture is flat, 
    so it is a pretty simple function! */
 #define parent_node(node) (node)
@@ -63,9 +60,6 @@
 	return first_cpu(mask);
 }
 
-/* Returns the number of the first MemBlk on Node 'node' */
-#define node_to_memblk(node) (node)
-
 /* Returns the number of the node containing PCI bus 'bus' */
 static inline cpumask_t pcibus_to_cpumask(int bus)
 {
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/include/asm-ia64/mmzone.h linux-2.6.2-rc1/include/asm-ia64/mmzone.h
--- orig/linux-2.6.2-rc1/include/asm-ia64/mmzone.h	Tue Jan 20 19:50:51 2004
+++ linux-2.6.2-rc1/include/asm-ia64/mmzone.h	Thu Jan 22 06:37:58 2004
@@ -20,11 +20,11 @@
 #ifdef CONFIG_IA64_DIG /* DIG systems are small */
 # define MAX_PHYSNODE_ID	8
 # define NR_NODES		8
-# define NR_MEMBLKS		(NR_NODES * 32)
+# define NR_NODE_MEMBLKS	(NR_NODES * 8)
 #else /* sn2 is the biggest case, so we use that if !DIG */
 # define MAX_PHYSNODE_ID	2048
 # define NR_NODES		256
-# define NR_MEMBLKS		(NR_NODES)
+# define NR_NODE_MEMBLKS	(NR_NODES * 4)
 #endif
 
 extern unsigned long max_low_pfn;
@@ -34,6 +34,6 @@
 #define pfn_to_page(pfn)	(vmem_map + (pfn))
 
 #else /* CONFIG_DISCONTIGMEM */
-# define NR_MEMBLKS		1
+# define NR_NODE_MEMBLKS	4
 #endif /* CONFIG_DISCONTIGMEM */
 #endif /* _ASM_IA64_MMZONE_H */
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/include/asm-ia64/numa.h linux-2.6.2-rc1/include/asm-ia64/numa.h
--- orig/linux-2.6.2-rc1/include/asm-ia64/numa.h	Tue Jan 20 19:49:47 2004
+++ linux-2.6.2-rc1/include/asm-ia64/numa.h	Thu Jan 22 06:41:26 2004
@@ -28,7 +28,7 @@
 
 /* Stuff below this line could be architecture independent */
 
-extern int num_memblks;		/* total number of memory chunks */
+extern int num_node_memblks;		/* total number of memory chunks */
 
 /*
  * List of node memory chunks. Filled when parsing SRAT table to
@@ -47,7 +47,7 @@
 	int	nid;		/* logical node containing this CPU */
 };
 
-extern struct node_memblk_s node_memblk[NR_MEMBLKS];
+extern struct node_memblk_s node_memblk[NR_NODE_MEMBLKS];
 extern struct node_cpuid_s node_cpuid[NR_CPUS];
 
 /*
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/include/asm-ia64/topology.h linux-2.6.2-rc1/include/asm-ia64/topology.h
--- orig/linux-2.6.2-rc1/include/asm-ia64/topology.h	Tue Jan 20 19:49:18 2004
+++ linux-2.6.2-rc1/include/asm-ia64/topology.h	Thu Jan 22 06:27:04 2004
@@ -29,15 +29,6 @@
 #define node_to_cpumask(node) (node_to_cpu_mask[node])
 
 /*
- * Returns the number of the node containing MemBlk 'memblk'
- */
-#ifdef CONFIG_ACPI_NUMA
-#define memblk_to_node(memblk) (node_memblk[memblk].nid)
-#else
-#define memblk_to_node(memblk) (memblk)
-#endif
-
-/*
  * Returns the number of the node containing Node 'nid'.
  * Not implemented here. Multi-level hierarchies detected with
  * the help of node_distance().
@@ -49,12 +40,6 @@
  */
 #define node_to_first_cpu(node) (__ffs(node_to_cpumask(node)))
 
-/*
- * Returns the number of the first MemBlk on Node 'node'
- * Should be fixed when IA64 discontigmem goes in.
- */
-#define node_to_memblk(node) (node)
-
 /* Cross-node load balancing interval. */
 #define NODE_BALANCE_RATE 10
 
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/include/asm-ppc64/topology.h linux-2.6.2-rc1/include/asm-ppc64/topology.h
--- orig/linux-2.6.2-rc1/include/asm-ppc64/topology.h	Tue Jan 20 19:50:40 2004
+++ linux-2.6.2-rc1/include/asm-ppc64/topology.h	Thu Jan 22 06:27:04 2004
@@ -19,8 +19,6 @@
 	return node;
 }
 
-#define memblk_to_node(memblk)	(memblk)
-
 #define parent_node(node)	(node)
 
 static inline cpumask_t node_to_cpumask(int node)
@@ -35,8 +33,6 @@
 	return first_cpu(tmp);
 }
 
-#define node_to_memblk(node)	(node)
-
 #define pcibus_to_cpumask(bus)	(cpu_online_map)
 
 #define nr_cpus_node(node)	(nr_cpus_in_node[node])
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/include/asm-x86_64/topology.h linux-2.6.2-rc1/include/asm-x86_64/topology.h
--- orig/linux-2.6.2-rc1/include/asm-x86_64/topology.h	Tue Jan 20 19:50:11 2004
+++ linux-2.6.2-rc1/include/asm-x86_64/topology.h	Thu Jan 22 06:27:04 2004
@@ -15,11 +15,9 @@
 extern unsigned long cpu_online_map;
 
 #define cpu_to_node(cpu)		(fake_node ? 0 : (cpu))
-#define memblk_to_node(memblk) 	(fake_node ? 0 : (memblk))
 #define parent_node(node)		(node)
 #define node_to_first_cpu(node) 	(fake_node ? 0 : (node))
 #define node_to_cpumask(node)	(fake_node ? cpu_online_map : (1UL << (node)))
-#define node_to_memblk(node)		(node)
 
 static inline unsigned long pcibus_to_cpumask(int bus)
 {
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/include/linux/memblk.h linux-2.6.2-rc1/include/linux/memblk.h
--- orig/linux-2.6.2-rc1/include/linux/memblk.h	Tue Jan 20 19:50:39 2004
+++ linux-2.6.2-rc1/include/linux/memblk.h	Wed Dec 31 16:00:00 1969
@@ -1,32 +0,0 @@
-/*
- * include/linux/memblk.h - generic memblk definition
- *
- * This is mainly for topological representation. We define the 
- * basic 'struct memblk' here, which can be embedded in per-arch 
- * definitions of memory blocks.
- *
- * Basic handling of the devices is done in drivers/base/memblk.c
- * and system devices are handled in drivers/base/sys.c. 
- *
- * MemBlks are exported via driverfs in the class/memblk/devices/
- * directory. 
- *
- * Per-memblk interfaces can be implemented using a struct device_interface. 
- * See the following for how to do this: 
- * - drivers/base/intf.c 
- * - Documentation/driver-model/interface.txt
- */
-#ifndef _LINUX_MEMBLK_H_
-#define _LINUX_MEMBLK_H_
-
-#include <linux/device.h>
-#include <linux/node.h>
-
-struct memblk {
-	int node_id;		/* The node which contains the MemBlk */
-	struct sys_device sysdev;
-};
-
-extern int register_memblk(struct memblk *, int, struct node *);
-
-#endif /* _LINUX_MEMBLK_H_ */
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/include/linux/mmzone.h linux-2.6.2-rc1/include/linux/mmzone.h
--- orig/linux-2.6.2-rc1/include/linux/mmzone.h	Tue Jan 20 19:50:03 2004
+++ linux-2.6.2-rc1/include/linux/mmzone.h	Thu Jan 22 06:27:04 2004
@@ -295,12 +295,6 @@
 int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *, 
 					  void *, size_t *);
 
-#ifdef CONFIG_NUMA
-#define MAX_NR_MEMBLKS	BITS_PER_LONG /* Max number of Memory Blocks */
-#else /* !CONFIG_NUMA */
-#define MAX_NR_MEMBLKS	1
-#endif /* CONFIG_NUMA */
-
 #include <linux/topology.h>
 /* Returns the number of the current Node. */
 #define numa_node_id()		(cpu_to_node(smp_processor_id()))
@@ -343,7 +337,6 @@
 #endif
 
 extern DECLARE_BITMAP(node_online_map, MAX_NUMNODES);
-extern DECLARE_BITMAP(memblk_online_map, MAX_NR_MEMBLKS);
 
 #if defined(CONFIG_DISCONTIGMEM) || defined(CONFIG_NUMA)
 
@@ -361,20 +354,6 @@
 	return num;
 }
 
-#define memblk_online(memblk)		test_bit(memblk, memblk_online_map)
-#define memblk_set_online(memblk)	set_bit(memblk, memblk_online_map)
-#define memblk_set_offline(memblk)	clear_bit(memblk, memblk_online_map)
-static inline unsigned int num_online_memblks(void)
-{
-	int i, num = 0;
-
-	for(i = 0; i < MAX_NR_MEMBLKS; i++){
-		if (memblk_online(i))
-			num++;
-	}
-	return num;
-}
-
 #else /* !CONFIG_DISCONTIGMEM && !CONFIG_NUMA */
 
 #define node_online(node) \
@@ -385,14 +364,6 @@
 	({ BUG_ON((node) != 0); clear_bit(node, node_online_map); })
 #define num_online_nodes()	1
 
-#define memblk_online(memblk) \
-	({ BUG_ON((memblk) != 0); test_bit(memblk, memblk_online_map); })
-#define memblk_set_online(memblk) \
-	({ BUG_ON((memblk) != 0); set_bit(memblk, memblk_online_map); })
-#define memblk_set_offline(memblk) \
-	({ BUG_ON((memblk) != 0); clear_bit(memblk, memblk_online_map); })
-#define num_online_memblks()		1
-
 #endif /* CONFIG_DISCONTIGMEM || CONFIG_NUMA */
 #endif /* !__ASSEMBLY__ */
 #endif /* __KERNEL__ */
diff -urN -X /usr/people/jes/exclude-linux orig/linux-2.6.2-rc1/mm/page_alloc.c linux-2.6.2-rc1/mm/page_alloc.c
--- orig/linux-2.6.2-rc1/mm/page_alloc.c	Tue Jan 20 19:49:21 2004
+++ linux-2.6.2-rc1/mm/page_alloc.c	Thu Jan 22 06:27:04 2004
@@ -35,7 +35,6 @@
 #include <asm/tlbflush.h>
 
 DECLARE_BITMAP(node_online_map, MAX_NUMNODES);
-DECLARE_BITMAP(memblk_online_map, MAX_NR_MEMBLKS);
 struct pglist_data *pgdat_list;
 unsigned long totalram_pages;
 unsigned long totalhigh_pages;
@@ -1392,7 +1391,6 @@
 	pgdat->node_mem_map = node_mem_map;
 
 	free_area_init_core(pgdat, zones_size, zholes_size);
-	memblk_set_online(node_to_memblk(nid));
 
 	calculate_zone_bitmap(pgdat, zones_size);
 }

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA
  2004-01-22 15:24               ` Jes Sorensen
@ 2004-01-23  6:09                 ` Martin J. Bligh
  0 siblings, 0 replies; 11+ messages in thread
From: Martin J. Bligh @ 2004-01-23  6:09 UTC (permalink / raw)
  To: Jes Sorensen; +Cc: Jack Steiner, linux-kernel, Jesse Barnes

>>> Tried it, no go! It conflicts with arch/ia64/mm/numa.c and
>>> arch/ia64/mm,/discontig.c as Jack had suggested.
> 
> Martin> Can you send me the build output? It shouldn't conflict
> Martin> ... there are two separate uses of the term "memblk" by the
> Martin> looks of it.
> 
> Ok,
> 
> This version boots, it seems we had to different uses of NR_MEMBLK in
> the kernel, I renamed one of them to NR_NODE_MEMBLK and it works.

Great - thanks for that. Nice to sort it out before the two uses got
more tangled together anyway ;-)

Thanks,

M.


^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2004-01-23  6:10 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-01-19 13:05 [patch] increse MAX_NR_MEMBLKS to same as MAX_NUMNODES on NUMA Jes Sorensen
2004-01-19 20:08 ` Martin J. Bligh
2004-01-19 22:45   ` Jack Steiner
2004-01-20  2:24     ` Jesse Barnes
2004-01-20  3:12       ` Jack Steiner
2004-01-20  6:25         ` Martin J. Bligh
2004-01-20 10:59           ` Jes Sorensen
2004-01-20 16:11             ` Martin J. Bligh
2004-01-22 15:24               ` Jes Sorensen
2004-01-23  6:09                 ` Martin J. Bligh
2004-01-20  5:21       ` Martin J. Bligh

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.