All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Dobson <colpatch@us.ibm.com>
To: Linus Torvalds <torvalds@transmeta.com>,
	Andrew Morton <akpm@digeo.com>,
	Rusty Russell <rusty@rustcorp.com.au>,
	Patrick Mochel <mochel@osdl.org>
Cc: linux-kernel <linux-kernel@vger.kernel.org>
Subject: [patch] memblk_online_map 2.5.45 (4/5)
Date: Wed, 30 Oct 2002 18:28:49 -0800	[thread overview]
Message-ID: <3DC09561.8090603@us.ibm.com> (raw)
In-Reply-To: 3DC09515.10701@us.ibm.com

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

Matthew Dobson wrote:
> Matthew Dobson wrote:
> 
>>
>> Linus,
>>     This series of patches creates a directory-based Topology in sysfs 
>> (driverfs).  This includes the per-node meminfo patch you wanted, as 
>> well as UP/SMP/NUMA topology.
>>     There were discussions between myself, Andrew, Rusty, and Patrick, 
>> and these are what we agreed on.
>>
>> (1/5) Core sysfs Topology:
>>     This patch creates the generic structures that are (will be)
>>     embedded in the per-arch structures.  Also creates calls to
>>     register these generic structures (CPUs, MemBlks, & Nodes).
>>
>>     Note that without arch-specific structures in which to embed
>>     these structures, and an arch-specific initialization routine,
>>     these functions/structures remain unused.
>>
>> (2/5) i386 sysfs Topology
>>     This patch creates the i386 specific files/functions/structures
>>     to implement driverfs Topology.  These structures have the
>>     generic CPU/MemBlk/Node structures embedded in them.
>>
>>     This patch also creates the arch-specific initialization routine
>>     to instantiate the topology.
>>
>> (3/5) per-node (NUMA) meminfo for sysfs Topology
>>     This patch adds code to DriverFS Topology to expose per-node
>>     memory statistics.
>>     This information is exposed via the nodeX/meminfo file.
>>
>>     The patch also adds 2 helper functions to gather per-node memory
>>     info.
>>
>> (4/5) memblk_online_map
>>     This patch creates a memblk_online_map, much like
>>     cpu_online_map.  It also creates the standard helper functions,
>>     ie: memblk_online(), num_online_memblks(), memblk_set_online(),
>>     memblk_set_offline().
>>
>>     This is used by driverFS topology to keep track of which memory
>>     blocks are in the system and online.
>>
>> (5/5) node_online_map
>>     This patch creates a node_online_map, much like cpu_online_map.
>>     It also creates the standard helper functions, ie:
>>     node_online(), num_online_nodes(), node_set_online(),
>>     node_set_offline().
>>
>>     This is used by driverFS topology to keep track of which Nodes
>>     are in the system and online.
>>
>> Cheers!
>>
>> -Matt

[-- Attachment #2: 04-memblk_online_map.patch --]
[-- Type: text/plain, Size: 2748 bytes --]

diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.45-base/arch/i386/mach-generic/topology.c linux-2.5.45-memblk_online_map/arch/i386/mach-generic/topology.c
--- linux-2.5.45-base/arch/i386/mach-generic/topology.c	Wed Oct 30 17:54:32 2002
+++ linux-2.5.45-memblk_online_map/arch/i386/mach-generic/topology.c	Wed Oct 30 18:02:17 2002
@@ -48,7 +48,7 @@
 		arch_register_node(i);
 	for (i = 0; i < NR_CPUS; i++)
 		if (cpu_possible(i)) arch_register_cpu(i);
-	for (i = 0; i < numnodes; i++)
+	for (i = 0; i < num_online_memblks(); i++)
 		arch_register_memblk(i);
 	return 0;
 }
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.45-base/include/linux/mmzone.h linux-2.5.45-memblk_online_map/include/linux/mmzone.h
--- linux-2.5.45-base/include/linux/mmzone.h	Wed Oct 30 16:41:34 2002
+++ linux-2.5.45-memblk_online_map/include/linux/mmzone.h	Wed Oct 30 18:02:17 2002
@@ -279,6 +279,38 @@
 
 #endif /* !CONFIG_DISCONTIGMEM */
 
+
+extern DECLARE_BITMAP(memblk_online_map, MAX_NR_MEMBLKS);
+
+#if defined(CONFIG_DISCONTIGMEM) || defined(CONFIG_NUMA)
+
+#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 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 */
+
+
 #define MAP_ALIGN(x)	((((x) % sizeof(struct page)) == 0) ? (x) : ((x) + \
 		sizeof(struct page) - ((x) % sizeof(struct page))))
 
diff -Nur --exclude-from=/usr/src/.dontdiff linux-2.5.45-base/mm/page_alloc.c linux-2.5.45-memblk_online_map/mm/page_alloc.c
--- linux-2.5.45-base/mm/page_alloc.c	Wed Oct 30 17:56:28 2002
+++ linux-2.5.45-memblk_online_map/mm/page_alloc.c	Wed Oct 30 18:02:17 2002
@@ -29,6 +29,9 @@
 #include <linux/slab.h>
 #include <linux/notifier.h>
 
+#include <asm/topology.h>
+
+DECLARE_BITMAP(memblk_online_map, MAX_NR_MEMBLKS);
 struct pglist_data *pgdat_list;
 unsigned long totalram_pages;
 unsigned long totalhigh_pages;
@@ -1163,6 +1166,7 @@
 	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);
 }

  reply	other threads:[~2002-10-31  2:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-10-31  2:24 [patch] Core sysfs Topology 2.5.45 (1/5) Matthew Dobson
2002-10-31  2:25 ` [patch] i386 sysfs Topology 2.5.45 (2/5) Matthew Dobson
2002-10-31  2:27   ` [patch] per-node (NUMA) meminfo for sysfs Topology 2.5.45 (3/5) Matthew Dobson
2002-10-31  2:28     ` Matthew Dobson [this message]
2002-10-31  2:30       ` [patch] node_online_map 2.5.45 (5/5) Matthew Dobson
2002-10-31  2:31 ` [patch] (resend) i386 sysfs Topology 2.5.45 (2/5) Matthew Dobson

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=3DC09561.8090603@us.ibm.com \
    --to=colpatch@us.ibm.com \
    --cc=akpm@digeo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mochel@osdl.org \
    --cc=rusty@rustcorp.com.au \
    --cc=torvalds@transmeta.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.