All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] Reduce MAX_NR_ZONES V1
@ 2006-07-07 23:18 Christoph Lameter
  2006-07-07 23:18 ` [PATCH 01/11] swap_prefetch: Remove incorrect use of ZONE_HIGHMEM Christoph Lameter
                   ` (10 more replies)
  0 siblings, 11 replies; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, KAMEZAWA Hiroyuki, Andi Kleen

I keep seeing zones on various platforms that are never used and wonder
why we compile support for them into the kernel. Counters show up for HIGHMEM
and DMA32 that are alway zero.

This patch allows the removal of ZONE_DMA32 for non x86_64 architectures
and it will get rid of ZONE_HIGHMEM for arches not using highmem
(like 64 bit architectures). If an arch does not define CONFIG_HIGHMEM
then ZONE_HIGHMEM will not be defined. Similarly if an arch does not
define CONFIG_ZONE_DMA32 then ZONE_DMA32 will not be defined.

No current architecture uses all the 4 zones (DMA,DMA32,NORMAL,HIGH) that we
have now. The patchset will reduce the number of zones for all platforms.

On many platforms that do not have DMA32 or HIGHMEM this will reduce the number
of zones by 50%. F.e. ia64 only uses DMA and NORMAL.

Large amounts of memory can be saved for larger systemss that may have a
few hundred NUMA nodes.

With ZONE_DMA32 and ZONE_HIGHMEM support optional MAX_NR_ZONES will be 2 for
many non i386 platforms and even for i386 without CONFIG_HIGHMEM set.

Tested on ia64, x86_64 and on i386 with and without highmem.

The patchset consists of 11 patches that are following this message.

One could go even further than this patchset and also make ZONE_DMA optional
because some platforms do not need a separate DMA zone and can do DMA to all
of memory. This could reduce MAX_NR_ZONES to 1. Such a patchset will hopefully follow
soon.

RFC->V1
- Macro cleanup
- Code cleanup
- Modify GFP_ZONETYPES according to the number of zones.
- Fix up i386 NUMA SRAT compile
- Get rid of CONFIG_DMA_IS_DMA32 etc.
- Resequence the patch so that the cleanup patches are first.
- Remove invalid refernce to HIGHMEM in swap prefetch
- Test and debug on i386


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

* [PATCH 01/11] swap_prefetch: Remove incorrect use of ZONE_HIGHMEM
  2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
@ 2006-07-07 23:18 ` Christoph Lameter
  2006-07-07 23:18 ` [PATCH 02/11] Remove two strange uses of MAX_NR_ZONES Christoph Lameter
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, Andi Kleen, KAMEZAWA Hiroyuki

swap_prefetch: Remove useless reference to HIGHMEM reserves.

HIGHMEM "reserves" are always zero. Remove the addition of the highmem
reserves.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/mm/swap_prefetch.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/swap_prefetch.c	2006-07-03 13:47:22.656121359 -0700
+++ linux-2.6.17-mm6/mm/swap_prefetch.c	2006-07-04 08:30:07.805828891 -0700
@@ -277,8 +277,7 @@ static void examine_free_limits(void)
 
 		ns = &sp_stat.node[z->zone_pgdat->node_id];
 		idx = zone_idx(z);
-		ns->lowfree[idx] = z->pages_high * 3 +
-			z->lowmem_reserve[ZONE_HIGHMEM];
+		ns->lowfree[idx] = z->pages_high * 3;
 		ns->highfree[idx] = ns->lowfree[idx] + z->pages_high;
 
 		if (z->free_pages > ns->highfree[idx]) {

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

* [PATCH 02/11] Remove two strange uses of MAX_NR_ZONES
  2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
  2006-07-07 23:18 ` [PATCH 01/11] swap_prefetch: Remove incorrect use of ZONE_HIGHMEM Christoph Lameter
@ 2006-07-07 23:18 ` Christoph Lameter
  2006-07-07 23:18 ` [PATCH 03/11] Fix MAX_NR_ZONES array initializations Christoph Lameter
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, KAMEZAWA Hiroyuki, Andi Kleen

Fix strange uses of MAX_NR_ZONES

Sometimes we use MAX_NR_ZONES - x to refer to a zone. Make that
explicit.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/arch/x86_64/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/x86_64/mm/init.c	2006-07-03 13:47:14.329487884 -0700
+++ linux-2.6.17-mm6/arch/x86_64/mm/init.c	2006-07-03 14:33:13.479261596 -0700
@@ -536,7 +536,7 @@ int memory_add_physaddr_to_nid(u64 start
 int arch_add_memory(int nid, u64 start, u64 size)
 {
 	struct pglist_data *pgdat = NODE_DATA(nid);
-	struct zone *zone = pgdat->node_zones + MAX_NR_ZONES-2;
+	struct zone *zone = pgdat->node_zones + ZONE_NORMAL;
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
 	int ret;
Index: linux-2.6.17-mm6/arch/i386/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/i386/mm/init.c	2006-07-03 13:47:12.740718955 -0700
+++ linux-2.6.17-mm6/arch/i386/mm/init.c	2006-07-03 14:33:13.481214600 -0700
@@ -657,7 +657,7 @@ void __init mem_init(void)
 int arch_add_memory(int nid, u64 start, u64 size)
 {
 	struct pglist_data *pgdata = &contig_page_data;
-	struct zone *zone = pgdata->node_zones + MAX_NR_ZONES-1;
+	struct zone *zone = pgdata->node_zones + ZONE_HIGHMEM;
 	unsigned long start_pfn = start >> PAGE_SHIFT;
 	unsigned long nr_pages = size >> PAGE_SHIFT;
 

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

* [PATCH 03/11] Fix MAX_NR_ZONES array initializations
  2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
  2006-07-07 23:18 ` [PATCH 01/11] swap_prefetch: Remove incorrect use of ZONE_HIGHMEM Christoph Lameter
  2006-07-07 23:18 ` [PATCH 02/11] Remove two strange uses of MAX_NR_ZONES Christoph Lameter
@ 2006-07-07 23:18 ` Christoph Lameter
  2006-07-07 23:18 ` [PATCH 04/11] Make display of highmem counters conditional on CONFIG_HIGHMEM Christoph Lameter
                   ` (7 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, Andi Kleen, KAMEZAWA Hiroyuki

Fix array initialization in lots of arches

The number of zones may now be reduced from 4 to 2 for many arches. Fix the
array initialization for the zones array for all architectures so that it
is not initializing a fixed number of elements.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/arch/sh64/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/sh64/mm/init.c	2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-mm6/arch/sh64/mm/init.c	2006-07-03 14:30:12.661342570 -0700
@@ -110,7 +110,7 @@ void show_mem(void)
  */
 void __init paging_init(void)
 {
-	unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+	unsigned long zones_size[MAX_NR_ZONES] = {0, };
 
 	pgd_init((unsigned long)swapper_pg_dir);
 	pgd_init((unsigned long)swapper_pg_dir +
Index: linux-2.6.17-mm6/arch/m32r/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/m32r/mm/init.c	2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-mm6/arch/m32r/mm/init.c	2006-07-03 14:30:12.656460059 -0700
@@ -100,7 +100,7 @@ void free_initrd_mem(unsigned long, unsi
 #ifndef CONFIG_DISCONTIGMEM
 unsigned long __init zone_sizes_init(void)
 {
-	unsigned long  zones_size[MAX_NR_ZONES] = {0, 0, 0};
+	unsigned long  zones_size[MAX_NR_ZONES] = {0, };
 	unsigned long  max_dma;
 	unsigned long  low;
 	unsigned long  start_pfn;
Index: linux-2.6.17-mm6/arch/parisc/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/parisc/mm/init.c	2006-07-03 13:47:13.329549726 -0700
+++ linux-2.6.17-mm6/arch/parisc/mm/init.c	2006-07-03 14:30:12.660366068 -0700
@@ -809,7 +809,7 @@ void __init paging_init(void)
 	flush_tlb_all_local(NULL);
 
 	for (i = 0; i < npmem_ranges; i++) {
-		unsigned long zones_size[MAX_NR_ZONES] = { 0, 0, 0 };
+		unsigned long zones_size[MAX_NR_ZONES] = { 0, };
 
 		/* We have an IOMMU, so all memory can go into a single
 		   ZONE_DMA zone. */
Index: linux-2.6.17-mm6/arch/i386/kernel/setup.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/i386/kernel/setup.c	2006-07-03 13:47:12.664551790 -0700
+++ linux-2.6.17-mm6/arch/i386/kernel/setup.c	2006-07-03 14:31:05.813329367 -0700
@@ -1201,7 +1201,7 @@ static unsigned long __init setup_memory
 
 void __init zone_sizes_init(void)
 {
-	unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+	unsigned long zones_size[MAX_NR_ZONES] = { 0, };
 	unsigned int max_dma, low;
 
 	max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
Index: linux-2.6.17-mm6/arch/m68knommu/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/m68knommu/mm/init.c	2006-07-03 13:47:12.941878389 -0700
+++ linux-2.6.17-mm6/arch/m68knommu/mm/init.c	2006-07-03 14:30:12.657436561 -0700
@@ -136,7 +136,7 @@ void paging_init(void)
 #endif
 
 	{
-		unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+		unsigned long zones_size[MAX_NR_ZONES] = {0, };
 
 		zones_size[ZONE_DMA] = 0 >> PAGE_SHIFT;
 		zones_size[ZONE_NORMAL] = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
Index: linux-2.6.17-mm6/arch/mips/sgi-ip27/ip27-memory.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/mips/sgi-ip27/ip27-memory.c	2006-07-03 13:47:13.274865608 -0700
+++ linux-2.6.17-mm6/arch/mips/sgi-ip27/ip27-memory.c	2006-07-03 14:30:12.659389566 -0700
@@ -508,7 +508,7 @@ extern unsigned long setup_zero_pages(vo
 
 void __init paging_init(void)
 {
-	unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+	unsigned long zones_size[MAX_NR_ZONES] = {0, };
 	unsigned node;
 
 	pagetable_init();
Index: linux-2.6.17-mm6/arch/frv/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/frv/mm/init.c	2006-07-03 13:47:12.538583018 -0700
+++ linux-2.6.17-mm6/arch/frv/mm/init.c	2006-07-03 14:30:12.654507055 -0700
@@ -98,7 +98,7 @@ void show_mem(void)
  */
 void __init paging_init(void)
 {
-	unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+	unsigned long zones_size[MAX_NR_ZONES] = {0, };
 
 	/* allocate some pages for kernel housekeeping tasks */
 	empty_bad_page_table	= (unsigned long) alloc_bootmem_pages(PAGE_SIZE);
Index: linux-2.6.17-mm6/arch/h8300/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/h8300/mm/init.c	2006-07-03 13:47:12.550301044 -0700
+++ linux-2.6.17-mm6/arch/h8300/mm/init.c	2006-07-03 14:30:12.655483557 -0700
@@ -138,7 +138,7 @@ void paging_init(void)
 #endif
 
 	{
-		unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+		unsigned long zones_size[MAX_NR_ZONES] = {0, };
 
 		zones_size[ZONE_DMA]     = 0 >> PAGE_SHIFT;
 		zones_size[ZONE_NORMAL]  = (end_mem - PAGE_OFFSET) >> PAGE_SHIFT;
Index: linux-2.6.17-mm6/arch/mips/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/mips/mm/init.c	2006-07-03 13:47:13.195768937 -0700
+++ linux-2.6.17-mm6/arch/mips/mm/init.c	2006-07-03 14:30:12.658413063 -0700
@@ -141,7 +141,7 @@ extern void pagetable_init(void);
 
 void __init paging_init(void)
 {
-	unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+	unsigned long zones_size[MAX_NR_ZONES] = {0, };
 	unsigned long max_dma, high, low;
 
 	pagetable_init();
Index: linux-2.6.17-mm6/arch/alpha/mm/init.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/alpha/mm/init.c	2006-07-03 13:47:11.897021133 -0700
+++ linux-2.6.17-mm6/arch/alpha/mm/init.c	2006-07-03 14:31:05.814305869 -0700
@@ -270,7 +270,7 @@ callback_init(void * kernel_end)
 void
 paging_init(void)
 {
-	unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+	unsigned long zones_size[MAX_NR_ZONES] = {0, };
 	unsigned long dma_pfn, high_pfn;
 
 	dma_pfn = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
Index: linux-2.6.17-mm6/arch/i386/mm/discontig.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/i386/mm/discontig.c	2006-07-03 13:47:12.735836444 -0700
+++ linux-2.6.17-mm6/arch/i386/mm/discontig.c	2006-07-03 14:31:05.815282371 -0700
@@ -354,7 +354,7 @@ void __init zone_sizes_init(void)
 
 
 	for_each_online_node(nid) {
-		unsigned long zones_size[MAX_NR_ZONES] = {0, 0, 0};
+		unsigned long zones_size[MAX_NR_ZONES] = {0, };
 		unsigned long *zholes_size;
 		unsigned int max_dma;
 

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

* [PATCH 04/11] Make display of highmem counters conditional on CONFIG_HIGHMEM
  2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
                   ` (2 preceding siblings ...)
  2006-07-07 23:18 ` [PATCH 03/11] Fix MAX_NR_ZONES array initializations Christoph Lameter
@ 2006-07-07 23:18 ` Christoph Lameter
  2006-07-07 23:18 ` [PATCH 05/11] Move HIGHMEM counters into highmem.c/.h Christoph Lameter
                   ` (6 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, KAMEZAWA Hiroyuki, Andi Kleen

Do not display HIGHMEM memory sizes if CONFIG_HIGHMEM is not set.

Make HIGHMEM dependent texts and make display of highmem counters optional

Some texts are depending on CONFIG_HIGHMEM.

Remove those strings and remove the display of highmem counter values if
CONFIG_HIGHMEM is not set.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/drivers/base/node.c
===================================================================
--- linux-2.6.17-mm6.orig/drivers/base/node.c	2006-07-03 13:47:14.847034002 -0700
+++ linux-2.6.17-mm6/drivers/base/node.c	2006-07-04 08:05:22.171357988 -0700
@@ -54,10 +54,12 @@ static ssize_t node_read_meminfo(struct 
 		       "Node %d MemUsed:      %8lu kB\n"
 		       "Node %d Active:       %8lu kB\n"
 		       "Node %d Inactive:     %8lu kB\n"
+#ifdef CONFIG_HIGHMEM
 		       "Node %d HighTotal:    %8lu kB\n"
 		       "Node %d HighFree:     %8lu kB\n"
 		       "Node %d LowTotal:     %8lu kB\n"
 		       "Node %d LowFree:      %8lu kB\n"
+#endif
 		       "Node %d Dirty:        %8lu kB\n"
 		       "Node %d Writeback:    %8lu kB\n"
 		       "Node %d FilePages:    %8lu kB\n"
@@ -72,10 +74,12 @@ static ssize_t node_read_meminfo(struct 
 		       nid, K(i.totalram - i.freeram),
 		       nid, K(active),
 		       nid, K(inactive),
+#ifdef CONFIG_HIGHMEM
 		       nid, K(i.totalhigh),
 		       nid, K(i.freehigh),
 		       nid, K(i.totalram - i.totalhigh),
 		       nid, K(i.freeram - i.freehigh),
+#endif
 		       nid, K(node_page_state(nid, NR_FILE_DIRTY)),
 		       nid, K(node_page_state(nid, NR_WRITEBACK)),
 		       nid, K(node_page_state(nid, NR_FILE_PAGES)),
Index: linux-2.6.17-mm6/fs/proc/proc_misc.c
===================================================================
--- linux-2.6.17-mm6.orig/fs/proc/proc_misc.c	2006-07-03 13:47:19.547915149 -0700
+++ linux-2.6.17-mm6/fs/proc/proc_misc.c	2006-07-04 08:05:22.186982019 -0700
@@ -157,10 +157,12 @@ static int meminfo_read_proc(char *page,
 		"SwapCached:   %8lu kB\n"
 		"Active:       %8lu kB\n"
 		"Inactive:     %8lu kB\n"
+#ifdef CONFIG_HIGHMEM
 		"HighTotal:    %8lu kB\n"
 		"HighFree:     %8lu kB\n"
 		"LowTotal:     %8lu kB\n"
 		"LowFree:      %8lu kB\n"
+#endif
 		"SwapTotal:    %8lu kB\n"
 		"SwapFree:     %8lu kB\n"
 		"Dirty:        %8lu kB\n"
@@ -183,10 +185,12 @@ static int meminfo_read_proc(char *page,
 		K(total_swapcache_pages),
 		K(active),
 		K(inactive),
+#ifdef CONFIG_HIGHMEM
 		K(i.totalhigh),
 		K(i.freehigh),
 		K(i.totalram-i.totalhigh),
 		K(i.freeram-i.freehigh),
+#endif
 		K(i.totalswap),
 		K(i.freeswap),
 		K(global_page_state(NR_FILE_DIRTY)),
Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c	2006-07-03 13:58:29.663697939 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c	2006-07-04 08:05:22.187958521 -0700
@@ -1371,9 +1371,13 @@ void show_free_areas(void)
 
 	get_zone_counts(&active, &inactive, &free);
 
+#ifdef CONFIG_HIGHMEM
 	printk("Free pages: %11ukB (%ukB HighMem)\n",
 		K(nr_free_pages()),
 		K(nr_free_highpages()));
+#else
+	printk("Free pages: %11ukB\n", K(nr_free_pages()));
+#endif
 
 	printk("Active:%lu inactive:%lu dirty:%lu writeback:%lu "
 		"unstable:%lu free:%u slab:%lu mapped:%lu pagetables:%lu\n",

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

* [PATCH 05/11] Move HIGHMEM counters into highmem.c/.h
  2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
                   ` (3 preceding siblings ...)
  2006-07-07 23:18 ` [PATCH 04/11] Make display of highmem counters conditional on CONFIG_HIGHMEM Christoph Lameter
@ 2006-07-07 23:18 ` Christoph Lameter
  2006-07-07 23:18 ` [PATCH 06/11] Page allocator ZONE_HIGHMEM cleanup Christoph Lameter
                   ` (5 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, Andi Kleen, KAMEZAWA Hiroyuki

Move totalhigh_pages and nr_free_highpages() into highmem.c/.h

Move the totalhigh_pages definition into highmem.c/.h.
Move the nr_free_highpages function into highmem.c

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/include/linux/highmem.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/highmem.h	2006-07-03 13:47:21.556579985 -0700
+++ linux-2.6.17-mm6/include/linux/highmem.h	2006-07-04 09:22:20.667685574 -0700
@@ -24,11 +24,14 @@ static inline void flush_kernel_dcache_p
 
 /* declarations for linux/mm/highmem.c */
 unsigned int nr_free_highpages(void);
+extern unsigned long totalhigh_pages;
 
 #else /* CONFIG_HIGHMEM */
 
 static inline unsigned int nr_free_highpages(void) { return 0; }
 
+#define totalhigh_pages 0
+
 static inline void *kmap(struct page *page)
 {
 	might_sleep();
Index: linux-2.6.17-mm6/include/linux/swap.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/swap.h	2006-07-03 13:47:22.066314085 -0700
+++ linux-2.6.17-mm6/include/linux/swap.h	2006-07-04 08:33:07.461701088 -0700
@@ -162,7 +162,6 @@ extern void swapin_readahead(swp_entry_t
 
 /* linux/mm/page_alloc.c */
 extern unsigned long totalram_pages;
-extern unsigned long totalhigh_pages;
 extern unsigned long totalreserve_pages;
 extern long nr_swap_pages;
 extern unsigned int nr_free_pages(void);
Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c	2006-07-04 08:32:32.671862242 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c	2006-07-04 09:21:35.699763226 -0700
@@ -51,7 +51,6 @@ EXPORT_SYMBOL(node_online_map);
 nodemask_t node_possible_map __read_mostly = NODE_MASK_ALL;
 EXPORT_SYMBOL(node_possible_map);
 unsigned long totalram_pages __read_mostly;
-unsigned long totalhigh_pages __read_mostly;
 unsigned long totalreserve_pages __read_mostly;
 long nr_swap_pages;
 int percpu_pagelist_fraction;
@@ -1259,20 +1258,6 @@ unsigned int nr_free_pagecache_pages(voi
 {
 	return nr_free_zone_pages(gfp_zone(GFP_HIGHUSER));
 }
-
-#ifdef CONFIG_HIGHMEM
-unsigned int nr_free_highpages (void)
-{
-	pg_data_t *pgdat;
-	unsigned int pages = 0;
-
-	for_each_online_pgdat(pgdat)
-		pages += pgdat->node_zones[ZONE_HIGHMEM].free_pages;
-
-	return pages;
-}
-#endif
-
 #ifdef CONFIG_NUMA
 static void show_node(struct zone *zone)
 {
Index: linux-2.6.17-mm6/mm/shmem.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/shmem.c	2006-07-03 13:47:22.646356337 -0700
+++ linux-2.6.17-mm6/mm/shmem.c	2006-07-04 08:33:07.464630594 -0700
@@ -45,6 +45,7 @@
 #include <linux/namei.h>
 #include <linux/ctype.h>
 #include <linux/migrate.h>
+#include <linux/highmem.h>
 
 #include <asm/uaccess.h>
 #include <asm/div64.h>
Index: linux-2.6.17-mm6/mm/highmem.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/highmem.c	2006-07-03 13:47:22.613155266 -0700
+++ linux-2.6.17-mm6/mm/highmem.c	2006-07-04 09:22:01.239199517 -0700
@@ -46,6 +46,19 @@ static void *mempool_alloc_pages_isa(gfp
  */
 #ifdef CONFIG_HIGHMEM
 
+unsigned long totalhigh_pages __read_mostly;
+
+unsigned int nr_free_highpages (void)
+{
+	pg_data_t *pgdat;
+	unsigned int pages = 0;
+
+	for_each_online_pgdat(pgdat)
+		pages += pgdat->node_zones[ZONE_HIGHMEM].free_pages;
+
+	return pages;
+}
+
 static int pkmap_count[LAST_PKMAP];
 static unsigned int last_pkmap_nr;
 static  __cacheline_aligned_in_smp DEFINE_SPINLOCK(kmap_lock);
Index: linux-2.6.17-mm6/arch/um/kernel/mem.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/um/kernel/mem.c	2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-mm6/arch/um/kernel/mem.c	2006-07-04 08:33:07.465607096 -0700
@@ -90,8 +90,10 @@ void mem_init(void)
 
 	/* this will put all low memory onto the freelists */
 	totalram_pages = free_all_bootmem();
+#ifdef CONFIG_HIGHMEM
 	totalhigh_pages = highmem >> PAGE_SHIFT;
 	totalram_pages += totalhigh_pages;
+#endif
 	num_physpages = totalram_pages;
 	max_pfn = totalram_pages;
 	printk(KERN_INFO "Memory: %luk available\n", 

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

* [PATCH 06/11] Page allocator ZONE_HIGHMEM cleanup
  2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
                   ` (4 preceding siblings ...)
  2006-07-07 23:18 ` [PATCH 05/11] Move HIGHMEM counters into highmem.c/.h Christoph Lameter
@ 2006-07-07 23:18 ` Christoph Lameter
  2006-07-07 23:18 ` [PATCH 07/11] Use enum to define zones, reformat and comment Christoph Lameter
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, KAMEZAWA Hiroyuki, Andi Kleen

page allocator ZONE_HIGHMEM fixups

1. We do not need to do an #ifdef in si_meminfo since both counters
   in use are zero if !CONFIG_HIGHMEM.

2. Add #ifdef in si_meminfo_node instead to avoid referencing zone
   information for ZONE_HIGHMEM if we do not have HIGHMEM
   (may not be there after the following patches).

3. Replace the use of ZONE_HIGHMEM with MAX_NR_ZONES in build_zonelists_node

4. build_zonelists_node: Remove BUG_ON for ZONE_HIGHMEM. Zone will
   be optional soon and thus BUG_ON cannot be triggered anymore.

5. init_free_area_core: Replace a use of ZONE_HIGHMEM with NR_MAX_ZONES.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c	2006-07-05 20:49:58.340089640 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c	2006-07-07 15:07:41.676482357 -0700
@@ -1289,13 +1289,8 @@ void si_meminfo(struct sysinfo *val)
 	val->sharedram = 0;
 	val->freeram = nr_free_pages();
 	val->bufferram = nr_blockdev_pages();
-#ifdef CONFIG_HIGHMEM
 	val->totalhigh = totalhigh_pages;
 	val->freehigh = nr_free_highpages();
-#else
-	val->totalhigh = 0;
-	val->freehigh = 0;
-#endif
 	val->mem_unit = PAGE_SIZE;
 }
 
@@ -1308,8 +1303,13 @@ void si_meminfo_node(struct sysinfo *val
 
 	val->totalram = pgdat->node_present_pages;
 	val->freeram = nr_free_pages_pgdat(pgdat);
+#ifdef CONFIG_HIGHMEM
 	val->totalhigh = pgdat->node_zones[ZONE_HIGHMEM].present_pages;
 	val->freehigh = pgdat->node_zones[ZONE_HIGHMEM].free_pages;
+#else
+	val->totalhigh = 0;
+	val->freehigh = 0;
+#endif
 	val->mem_unit = PAGE_SIZE;
 }
 #endif
@@ -1442,14 +1442,11 @@ static int __meminit build_zonelists_nod
 {
 	struct zone *zone;
 
-	BUG_ON(zone_type > ZONE_HIGHMEM);
+	BUG_ON(zone_type >= MAX_NR_ZONES);
 
 	do {
 		zone = pgdat->node_zones + zone_type;
 		if (populated_zone(zone)) {
-#ifndef CONFIG_HIGHMEM
-			BUG_ON(zone_type > ZONE_NORMAL);
-#endif
 			zonelist->zones[nr_zones++] = zone;
 			check_highest_zone(zone_type);
 		}
@@ -2080,7 +2077,7 @@ static void __meminit free_area_init_cor
 		if (zholes_size)
 			realsize -= zholes_size[j];
 
-		if (j < ZONE_HIGHMEM)
+		if (!is_highmem_idx(j))
 			nr_kernel_pages += realsize;
 		nr_all_pages += realsize;
 

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

* [PATCH 07/11] Use enum to define zones, reformat and comment
  2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
                   ` (5 preceding siblings ...)
  2006-07-07 23:18 ` [PATCH 06/11] Page allocator ZONE_HIGHMEM cleanup Christoph Lameter
@ 2006-07-07 23:18 ` Christoph Lameter
  2006-07-08  0:56   ` Andrew Morton
  2006-07-07 23:18 ` [PATCH 08/11] Make ZONE_DMA32 optional Christoph Lameter
                   ` (3 subsequent siblings)
  10 siblings, 1 reply; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, Andi Kleen, KAMEZAWA Hiroyuki

Use enum for zones and reformat zones dependent information

Add comments explaning the use of zones and add a zones_t type for
zone numbers.

Line up information that will be #ifdefd by the following patches.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/include/linux/mmzone.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/mmzone.h	2006-07-03 13:47:21.738209377 -0700
+++ linux-2.6.17-mm6/include/linux/mmzone.h	2006-07-07 15:07:44.652861225 -0700
@@ -87,14 +87,53 @@ struct per_cpu_pageset {
 #define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
 #endif
 
-#define ZONE_DMA		0
-#define ZONE_DMA32		1
-#define ZONE_NORMAL		2
-#define ZONE_HIGHMEM		3
+typedef enum {
+	/*
+	 * ZONE_DMA is used when there are devices that are not able
+	 * to do DMA to all of addressable memory (ZONE_NORMAL). Then we
+	 * carve out the portion of memory that is needed for these devices.
+	 * The range is arch specific.
+	 *
+	 * Some examples
+	 *
+	 * Architecture		Limit
+	 * ---------------------------
+	 * parisc, ia64, sparc	<4G
+	 * s390			<2G
+	 * arm26		<48M
+	 * arm			Various
+	 * alpha		Unlimited or 0-16MB.
+	 *
+	 * i386, x86_64 and multiple other arches
+	 * 			<16M.
+	 */
+	ZONE_DMA,
+	/*
+	 * x86_64 needs two ZONE_DMAs because it supports devices that are
+	 * only able to do DMA to the lower 16M but also 32 bit devices that
+	 * can only do DMA areas below 4G.
+	 */
+	ZONE_DMA32,
+	/*
+	 * Normal addressable memory is in ZONE_NORMAL. DMA operations can be
+	 * performed on pages in ZONE_NORMAL if the DMA devices support
+	 * transfers to all addressable memory.
+	 */
+	ZONE_NORMAL,
+	/*
+	 * A memory area that is only addressable by the kernel through
+	 * mapping portions into its own address space. This is for example
+	 * used by i386 to allow the kernel to address the memory beyond
+	 * 900MB. The kernel will set up special mappings (page
+	 * table entries on i386) for each page that the kernel needs to
+	 * access.
+	 */
+	ZONE_HIGHMEM,
 
-#define MAX_NR_ZONES		4	/* Sync this with ZONES_SHIFT */
-#define ZONES_SHIFT		2	/* ceil(log2(MAX_NR_ZONES)) */
+	MAX_NR_ZONES
+} zones_t;
 
+#define	ZONES_SHIFT		2	/* ceil(log2(MAX_NR_ZONES)) */
 
 /*
  * When a memory allocation must conform to specific limitations (such
@@ -125,16 +164,6 @@ struct per_cpu_pageset {
 /* #define GFP_ZONETYPES       (GFP_ZONEMASK + 1) */           /* Non-loner */
 #define GFP_ZONETYPES  ((GFP_ZONEMASK + 1) / 2 + 1)            /* Loner */
 
-/*
- * On machines where it is needed (eg PCs) we divide physical memory
- * into multiple physical zones. On a 32bit PC we have 4 zones:
- *
- * ZONE_DMA	  < 16 MB	ISA DMA capable memory
- * ZONE_DMA32	     0 MB 	Empty
- * ZONE_NORMAL	16-896 MB	direct mapped by the kernel
- * ZONE_HIGHMEM	 > 896 MB	only page cache and user processes
- */
-
 struct zone {
 	/* Fields commonly accessed by the page allocator */
 	unsigned long		free_pages;
@@ -270,7 +299,6 @@ struct zone {
 	char			*name;
 } ____cacheline_internodealigned_in_smp;
 
-
 /*
  * The "priority" of VM scanning is how much of the queues we will scan in one
  * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
@@ -378,12 +406,12 @@ static inline int populated_zone(struct 
 	return (!!zone->present_pages);
 }
 
-static inline int is_highmem_idx(int idx)
+static inline int is_highmem_idx(zones_t idx)
 {
 	return (idx == ZONE_HIGHMEM);
 }
 
-static inline int is_normal_idx(int idx)
+static inline int is_normal_idx(zones_t idx)
 {
 	return (idx == ZONE_NORMAL);
 }
Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c	2006-07-07 15:07:41.676482357 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c	2006-07-07 15:07:44.654814230 -0700
@@ -68,7 +68,11 @@ static void __free_pages_ok(struct page 
  * TBD: should special case ZONE_DMA32 machines here - in those we normally
  * don't need any ZONE_NORMAL reservation
  */
-int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = { 256, 256, 32 };
+int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
+	 256,
+	 256,
+	 32
+};
 
 EXPORT_SYMBOL(totalram_pages);
 
@@ -79,7 +83,13 @@ EXPORT_SYMBOL(totalram_pages);
 struct zone *zone_table[1 << ZONETABLE_SHIFT] __read_mostly;
 EXPORT_SYMBOL(zone_table);
 
-static char *zone_names[MAX_NR_ZONES] = { "DMA", "DMA32", "Normal", "HighMem" };
+static char *zone_names[MAX_NR_ZONES] = {
+	 "DMA",
+	 "DMA32",
+	 "Normal",
+	 "HighMem"
+};
+
 int min_free_kbytes = 1024;
 
 unsigned long __meminitdata nr_kernel_pages;
@@ -1585,7 +1595,8 @@ static void __meminit build_zonelists(pg
 
 static void __meminit build_zonelists(pg_data_t *pgdat)
 {
-	int i, j, k, node, local_node;
+	int i, node, local_node;
+	zones_t k,j;
 
 	local_node = pgdat->node_id;
 	for (i = 0; i < GFP_ZONETYPES; i++) {
@@ -1776,8 +1787,8 @@ void zone_init_free_lists(struct pglist_
 }
 
 #define ZONETABLE_INDEX(x, zone_nr)	((x << ZONES_SHIFT) | zone_nr)
-void zonetable_add(struct zone *zone, int nid, int zid, unsigned long pfn,
-		unsigned long size)
+void zonetable_add(struct zone *zone, int nid, zones_t zid,
+		unsigned long pfn, unsigned long size)
 {
 	unsigned long snum = pfn_to_section_nr(pfn);
 	unsigned long end = pfn_to_section_nr(pfn + size);
@@ -2059,7 +2070,7 @@ __meminit int init_currently_empty_zone(
 static void __meminit free_area_init_core(struct pglist_data *pgdat,
 		unsigned long *zones_size, unsigned long *zholes_size)
 {
-	unsigned long j;
+	zones_t j;
 	int nid = pgdat->node_id;
 	unsigned long zone_start_pfn = pgdat->node_start_pfn;
 	int ret;
Index: linux-2.6.17-mm6/include/linux/mm.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/mm.h	2006-07-05 23:32:04.193233853 -0700
+++ linux-2.6.17-mm6/include/linux/mm.h	2006-07-07 15:07:44.661649745 -0700
@@ -474,7 +474,7 @@ void split_page(struct page *page, unsig
 #define SECTIONS_MASK		((1UL << SECTIONS_WIDTH) - 1)
 #define ZONETABLE_MASK		((1UL << ZONETABLE_SHIFT) - 1)
 
-static inline unsigned long page_zonenum(struct page *page)
+static inline zones_t page_zonenum(struct page *page)
 {
 	return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
 }
@@ -503,11 +503,12 @@ static inline unsigned long page_to_sect
 	return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
 }
 
-static inline void set_page_zone(struct page *page, unsigned long zone)
+static inline void set_page_zone(struct page *page, zones_t zone)
 {
 	page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
 	page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
 }
+
 static inline void set_page_node(struct page *page, unsigned long node)
 {
 	page->flags &= ~(NODES_MASK << NODES_PGSHIFT);
@@ -519,7 +520,7 @@ static inline void set_page_section(stru
 	page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
 }
 
-static inline void set_page_links(struct page *page, unsigned long zone,
+static inline void set_page_links(struct page *page, zones_t zone,
 	unsigned long node, unsigned long pfn)
 {
 	set_page_zone(page, zone);

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

* [PATCH 08/11] Make ZONE_DMA32 optional
  2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
                   ` (6 preceding siblings ...)
  2006-07-07 23:18 ` [PATCH 07/11] Use enum to define zones, reformat and comment Christoph Lameter
@ 2006-07-07 23:18 ` Christoph Lameter
  2006-07-07 23:18 ` [PATCH 09/11] Make ZONE_HIGHMEM optional Christoph Lameter
                   ` (2 subsequent siblings)
  10 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, KAMEZAWA Hiroyuki, Andi Kleen

Make ZONE_DMA32 optional

- Add #ifdefs around ZONE_DMA32 specific code and definitions.

- Add CONFIG_ZONE_DMA32 config option and use that for x86_64
  that alone needs this zone.

- Remove the use of CONFIG_DMA_IS_DMA32 and CONFIG_DMA_IS_NORMAL
  for ia64 and fix up the way per node ZVCs are calculated.

- Fall back to prior GFP_ZONEMASK of 0x03 if there is no
  DMA32 zone.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c	2006-07-07 15:07:44.654814230 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c	2006-07-07 15:07:48.160457319 -0700
@@ -70,7 +70,9 @@ static void __free_pages_ok(struct page 
  */
 int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
 	 256,
+#ifdef CONFIG_ZONE_DMA32
 	 256,
+#endif
 	 32
 };
 
@@ -85,7 +87,9 @@ EXPORT_SYMBOL(zone_table);
 
 static char *zone_names[MAX_NR_ZONES] = {
 	 "DMA",
+#ifdef CONFIG_ZONE_DMA32
 	 "DMA32",
+#endif
 	 "Normal",
 	 "HighMem"
 };
@@ -1471,8 +1475,10 @@ static inline int highest_zone(int zone_
 	int res = ZONE_NORMAL;
 	if (zone_bits & (__force int)__GFP_HIGHMEM)
 		res = ZONE_HIGHMEM;
+#ifdef CONFIG_ZONE_DMA32
 	if (zone_bits & (__force int)__GFP_DMA32)
 		res = ZONE_DMA32;
+#endif
 	if (zone_bits & (__force int)__GFP_DMA)
 		res = ZONE_DMA;
 	return res;
Index: linux-2.6.17-mm6/include/linux/mmzone.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/mmzone.h	2006-07-07 15:07:44.652861225 -0700
+++ linux-2.6.17-mm6/include/linux/mmzone.h	2006-07-07 15:07:48.161433821 -0700
@@ -108,12 +108,14 @@ typedef enum {
 	 * 			<16M.
 	 */
 	ZONE_DMA,
+#ifdef CONFIG_ZONE_DMA32
 	/*
 	 * x86_64 needs two ZONE_DMAs because it supports devices that are
 	 * only able to do DMA to the lower 16M but also 32 bit devices that
 	 * can only do DMA areas below 4G.
 	 */
 	ZONE_DMA32,
+#endif
 	/*
 	 * Normal addressable memory is in ZONE_NORMAL. DMA operations can be
 	 * performed on pages in ZONE_NORMAL if the DMA devices support
@@ -160,9 +162,13 @@ typedef enum {
  *
  * NOTE! Make sure this matches the zones in <linux/gfp.h>
  */
-#define GFP_ZONEMASK	0x07
-/* #define GFP_ZONETYPES       (GFP_ZONEMASK + 1) */           /* Non-loner */
-#define GFP_ZONETYPES  ((GFP_ZONEMASK + 1) / 2 + 1)            /* Loner */
+#define GFP_ZONETYPES		((GFP_ZONEMASK + 1) / 2 + 1)    /* Loner */
+
+#ifdef CONFIG_ZONE_DMA32
+#define GFP_ZONEMASK		0x07
+#else
+#define GFP_ZONEMASK		0x03
+#endif
 
 struct zone {
 	/* Fields commonly accessed by the page allocator */
@@ -434,7 +440,11 @@ static inline int is_normal(struct zone 
 
 static inline int is_dma32(struct zone *zone)
 {
+#ifdef CONFIG_ZONE_DMA32
 	return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
+#else
+	return 0;
+#endif
 }
 
 static inline int is_dma(struct zone *zone)
Index: linux-2.6.17-mm6/include/linux/gfp.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/gfp.h	2006-07-03 13:47:21.552673977 -0700
+++ linux-2.6.17-mm6/include/linux/gfp.h	2006-07-07 15:07:48.199517409 -0700
@@ -13,7 +13,7 @@ struct vm_area_struct;
 /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
 #define __GFP_DMA	((__force gfp_t)0x01u)
 #define __GFP_HIGHMEM	((__force gfp_t)0x02u)
-#ifdef CONFIG_DMA_IS_DMA32
+#ifndef CONFIG_ZONE_DMA32
 #define __GFP_DMA32	((__force gfp_t)0x01)	/* ZONE_DMA is ZONE_DMA32 */
 #elif BITS_PER_LONG < 64
 #define __GFP_DMA32	((__force gfp_t)0x00)	/* ZONE_NORMAL is ZONE_DMA32 */
Index: linux-2.6.17-mm6/include/linux/vmstat.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/vmstat.h	2006-07-03 13:47:22.185447343 -0700
+++ linux-2.6.17-mm6/include/linux/vmstat.h	2006-07-07 15:07:48.210258933 -0700
@@ -124,12 +124,10 @@ static inline unsigned long node_page_st
 	struct zone *zones = NODE_DATA(node)->node_zones;
 
 	return
-#ifndef CONFIG_DMA_IS_NORMAL
-#if !defined(CONFIG_DMA_IS_DMA32) && BITS_PER_LONG >= 64
+#ifdef CONFIG_ZONE_DMA32
 		zone_page_state(&zones[ZONE_DMA32], item) +
 #endif
 		zone_page_state(&zones[ZONE_NORMAL], item) +
-#endif
 #ifdef CONFIG_HIGHMEM
 		zone_page_state(&zones[ZONE_HIGHMEM], item) +
 #endif
Index: linux-2.6.17-mm6/arch/ia64/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/ia64/Kconfig	2006-07-03 13:47:12.766108010 -0700
+++ linux-2.6.17-mm6/arch/ia64/Kconfig	2006-07-07 15:07:48.218070952 -0700
@@ -66,15 +66,6 @@ config IA64_UNCACHED_ALLOCATOR
 	bool
 	select GENERIC_ALLOCATOR
 
-config DMA_IS_DMA32
-	bool
-	default y
-
-config DMA_IS_NORMAL
-	bool
-	depends on IA64_SGI_SN2
-	default y
-
 choice
 	prompt "System type"
 	default IA64_GENERIC
Index: linux-2.6.17-mm6/arch/x86_64/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/x86_64/Kconfig	2006-07-03 13:47:14.227931665 -0700
+++ linux-2.6.17-mm6/arch/x86_64/Kconfig	2006-07-07 15:07:48.240530503 -0700
@@ -24,6 +24,10 @@ config X86
 	bool
 	default y
 
+config ZONE_DMA32
+	bool
+	default y
+
 config LOCKDEP_SUPPORT
 	bool
 	default y

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

* [PATCH 09/11] Make ZONE_HIGHMEM optional
  2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
                   ` (7 preceding siblings ...)
  2006-07-07 23:18 ` [PATCH 08/11] Make ZONE_DMA32 optional Christoph Lameter
@ 2006-07-07 23:18 ` Christoph Lameter
  2006-07-07 23:19 ` [PATCH 10/11] Remove display of counters for unconfigured zones Christoph Lameter
  2006-07-07 23:19 ` [PATCH 11/11] Fix i386 SRAT check for MAX_NR_ZONES Christoph Lameter
  10 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:18 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, Andi Kleen, KAMEZAWA Hiroyuki

Make ZONE_HIGHMEM optional

- ifdef out code and definitions related to CONFIG_HIGHMEM

- __GFP_HIGHMEM falls back to normal allocations if there is no
  ZONE_HIGHMEM

- GFP_ZONEMASK becomes 0x01 if there is no DMA32 and no HIGHMEM
  zone.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/include/linux/gfp.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/gfp.h	2006-07-07 15:07:48.199517409 -0700
+++ linux-2.6.17-mm6/include/linux/gfp.h	2006-07-07 15:07:51.984440142 -0700
@@ -12,7 +12,13 @@ struct vm_area_struct;
  */
 /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
 #define __GFP_DMA	((__force gfp_t)0x01u)
+
+#ifdef CONFIG_HIGHMEM
 #define __GFP_HIGHMEM	((__force gfp_t)0x02u)
+#else
+#define __GFP_HIGHMEM	((__force gfp_t)0x00)	/* NORMAL is HIGHMEM */
+#endif
+
 #ifndef CONFIG_ZONE_DMA32
 #define __GFP_DMA32	((__force gfp_t)0x01)	/* ZONE_DMA is ZONE_DMA32 */
 #elif BITS_PER_LONG < 64
Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c	2006-07-07 15:07:48.160457319 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c	2006-07-07 15:07:51.986393146 -0700
@@ -73,7 +73,9 @@ int sysctl_lowmem_reserve_ratio[MAX_NR_Z
 #ifdef CONFIG_ZONE_DMA32
 	 256,
 #endif
+#ifdef CONFIG_HIGHMEM
 	 32
+#endif
 };
 
 EXPORT_SYMBOL(totalram_pages);
@@ -91,7 +93,9 @@ static char *zone_names[MAX_NR_ZONES] = 
 	 "DMA32",
 #endif
 	 "Normal",
+#ifdef CONFIG_HIGHMEM
 	 "HighMem"
+#endif
 };
 
 int min_free_kbytes = 1024;
@@ -1473,8 +1477,10 @@ static int __meminit build_zonelists_nod
 static inline int highest_zone(int zone_bits)
 {
 	int res = ZONE_NORMAL;
+#ifdef CONFIG_HIGHMEM
 	if (zone_bits & (__force int)__GFP_HIGHMEM)
 		res = ZONE_HIGHMEM;
+#endif
 #ifdef CONFIG_ZONE_DMA32
 	if (zone_bits & (__force int)__GFP_DMA32)
 		res = ZONE_DMA32;
Index: linux-2.6.17-mm6/include/linux/mmzone.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/mmzone.h	2006-07-07 15:07:48.161433821 -0700
+++ linux-2.6.17-mm6/include/linux/mmzone.h	2006-07-07 15:07:51.987369648 -0700
@@ -122,6 +122,7 @@ typedef enum {
 	 * transfers to all addressable memory.
 	 */
 	ZONE_NORMAL,
+#ifdef CONFIG_HIGHMEM
 	/*
 	 * A memory area that is only addressable by the kernel through
 	 * mapping portions into its own address space. This is for example
@@ -131,11 +132,10 @@ typedef enum {
 	 * access.
 	 */
 	ZONE_HIGHMEM,
-
+#endif
 	MAX_NR_ZONES
 } zones_t;
 
-#define	ZONES_SHIFT		2	/* ceil(log2(MAX_NR_ZONES)) */
 
 /*
  * When a memory allocation must conform to specific limitations (such
@@ -166,8 +166,15 @@ typedef enum {
 
 #ifdef CONFIG_ZONE_DMA32
 #define GFP_ZONEMASK		0x07
+#define	ZONES_SHIFT		2	/* ceil(log2(MAX_NR_ZONES)) */
 #else
+#ifdef CONFIG_HIGHMEM
 #define GFP_ZONEMASK		0x03
+#define	ZONES_SHIFT		2
+#else
+#define GFP_ZONEMASK		0x01
+#define ZONES_SHIFT		1
+#endif
 #endif
 
 struct zone {
@@ -414,7 +421,11 @@ static inline int populated_zone(struct 
 
 static inline int is_highmem_idx(zones_t idx)
 {
+#ifdef CONFIG_HIGHMEM
 	return (idx == ZONE_HIGHMEM);
+#else
+	return 0;
+#endif
 }
 
 static inline int is_normal_idx(zones_t idx)
@@ -430,7 +441,11 @@ static inline int is_normal_idx(zones_t 
  */
 static inline int is_highmem(struct zone *zone)
 {
+#ifdef CONFIG_HIGHMEM
 	return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM;
+#else
+	return 0;
+#endif
 }
 
 static inline int is_normal(struct zone *zone)

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

* [PATCH 10/11] Remove display of counters for unconfigured zones
  2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
                   ` (8 preceding siblings ...)
  2006-07-07 23:18 ` [PATCH 09/11] Make ZONE_HIGHMEM optional Christoph Lameter
@ 2006-07-07 23:19 ` Christoph Lameter
  2006-07-07 23:19 ` [PATCH 11/11] Fix i386 SRAT check for MAX_NR_ZONES Christoph Lameter
  10 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:19 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, KAMEZAWA Hiroyuki, Andi Kleen

eventcounters: Do not display counters for zones that are not available on an arch

Do not define or display counters for the DMA32 and the HIGHMEM zone
if such zones were not configured.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/include/linux/vmstat.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/vmstat.h	2006-07-04 09:24:16.598992964 -0700
+++ linux-2.6.17-mm6/include/linux/vmstat.h	2006-07-04 10:29:07.430918443 -0700
@@ -18,7 +18,19 @@
  * generated will simply be the increment of a global address.
  */
 
-#define FOR_ALL_ZONES(x) x##_DMA, x##_DMA32, x##_NORMAL, x##_HIGH
+#ifdef CONFIG_ZONE_DMA32
+#define DMA32_ZONE(xx) xx##_DMA32,
+#else
+#define DMA32_ZONE(xx)
+#endif
+
+#ifdef CONFIG_HIGHMEM
+#define HIGHMEM_ZONE(xx) , xx##_HIGH
+#else
+#define HIGHMEM_ZONE(xx)
+#endif
+
+#define FOR_ALL_ZONES(xx) xx##_DMA, DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx)
 
 enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
 		FOR_ALL_ZONES(PGALLOC),
Index: linux-2.6.17-mm6/mm/vmstat.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/vmstat.c	2006-07-03 13:47:22.663933375 -0700
+++ linux-2.6.17-mm6/mm/vmstat.c	2006-07-04 09:33:08.440126002 -0700
@@ -381,6 +381,21 @@ struct seq_operations fragmentation_op =
 	.show	= frag_show,
 };
 
+#ifdef CONFIG_ZONE_DMA32
+#define TEXT_FOR_DMA32(xx) xx "_dma32",
+#else
+#define TEXT_FOR_DMA32(xx)
+#endif
+
+#ifdef CONFIG_HIGHMEM
+#define TEXT_FOR_HIGHMEM(xx) xx "_high",
+#else
+#define TEXT_FOR_HIGHMEM(xx)
+#endif
+
+#define TEXTS_FOR_ZONES(xx) xx "_dma", TEXT_FOR_DMA32(xx) xx "_normal", \
+					TEXT_FOR_HIGHMEM(xx)
+
 static char *vmstat_text[] = {
 	/* Zoned VM counters */
 	"nr_anon_pages",
@@ -408,10 +423,7 @@ static char *vmstat_text[] = {
 	"pswpin",
 	"pswpout",
 
-	"pgalloc_dma",
-	"pgalloc_dma32",
-	"pgalloc_normal",
-	"pgalloc_high",
+	TEXTS_FOR_ZONES("pgalloc")
 
 	"pgfree",
 	"pgactivate",
@@ -420,25 +432,10 @@ static char *vmstat_text[] = {
 	"pgfault",
 	"pgmajfault",
 
-	"pgrefill_dma",
-	"pgrefill_dma32",
-	"pgrefill_normal",
-	"pgrefill_high",
-
-	"pgsteal_dma",
-	"pgsteal_dma32",
-	"pgsteal_normal",
-	"pgsteal_high",
-
-	"pgscan_kswapd_dma",
-	"pgscan_kswapd_dma32",
-	"pgscan_kswapd_normal",
-	"pgscan_kswapd_high",
-
-	"pgscan_direct_dma",
-	"pgscan_direct_dma32",
-	"pgscan_direct_normal",
-	"pgscan_direct_high",
+	TEXTS_FOR_ZONES("pgrefill")
+	TEXTS_FOR_ZONES("pgsteal")
+	TEXTS_FOR_ZONES("pgscan_kswapd")
+	TEXTS_FOR_ZONES("pgscan_direct")
 
 	"pginodesteal",
 	"slabs_scanned",

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

* [PATCH 11/11] Fix i386 SRAT check for MAX_NR_ZONES
  2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
                   ` (9 preceding siblings ...)
  2006-07-07 23:19 ` [PATCH 10/11] Remove display of counters for unconfigured zones Christoph Lameter
@ 2006-07-07 23:19 ` Christoph Lameter
  10 siblings, 0 replies; 13+ messages in thread
From: Christoph Lameter @ 2006-07-07 23:19 UTC (permalink / raw)
  To: linux-kernel
  Cc: akpm, Hugh Dickins, Christoph Hellwig, Con Kolivas,
	Marcelo Tosatti, Arjan van de Ven, Nick Piggin,
	Christoph Lameter, Andi Kleen, KAMEZAWA Hiroyuki

i386 SRAT: Fix MAX_NR_ZONES check

We cannot check MAX_NR_ZONES since it not defined in the preprocessor
anymore. So remove the check.

The maximum number of zones per node for i386 is 3 since i386 does
not support ZONE_DMA32.

Signed-off-by: Christoph Lameter <clameter@sgi.com>

Index: linux-2.6.17-mm6/arch/i386/kernel/srat.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/i386/kernel/srat.c	2006-07-03 13:47:12.667481297 -0700
+++ linux-2.6.17-mm6/arch/i386/kernel/srat.c	2006-07-04 07:59:13.710812064 -0700
@@ -42,7 +42,7 @@
 #define PXM_BITMAP_LEN (MAX_PXM_DOMAINS / 8) 
 static u8 pxm_bitmap[PXM_BITMAP_LEN];	/* bitmap of proximity domains */
 
-#define MAX_CHUNKS_PER_NODE	4
+#define MAX_CHUNKS_PER_NODE	3
 #define MAXCHUNKS		(MAX_CHUNKS_PER_NODE * MAX_NUMNODES)
 struct node_memory_chunk_s {
 	unsigned long	start_pfn;
@@ -135,9 +135,6 @@ static void __init parse_memory_affinity
 		 "enabled and removable" : "enabled" ) );
 }
 
-#if MAX_NR_ZONES != 4
-#error "MAX_NR_ZONES != 4, chunk_to_zone requires review"
-#endif
 /* Take a chunk of pages from page frame cstart to cend and count the number
  * of pages in each zone, returned via zones[].
  */

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

* Re: [PATCH 07/11] Use enum to define zones, reformat and comment
  2006-07-07 23:18 ` [PATCH 07/11] Use enum to define zones, reformat and comment Christoph Lameter
@ 2006-07-08  0:56   ` Andrew Morton
  0 siblings, 0 replies; 13+ messages in thread
From: Andrew Morton @ 2006-07-08  0:56 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-kernel, hugh, hch, kernel, marcelo, arjan, nickpiggin,
	clameter, ak, kamezawa.hiroyu

Christoph Lameter <clameter@sgi.com> wrote:
>
> +typedef enum {
> ...
> +} zones_t;

ooooh noooooo you don't, big guy.



diff -puN include/linux/mm.h~reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment-cleanup include/linux/mm.h
--- a/include/linux/mm.h~reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment-cleanup
+++ a/include/linux/mm.h
@@ -469,7 +469,7 @@ void split_page(struct page *page, unsig
 #define SECTIONS_MASK		((1UL << SECTIONS_WIDTH) - 1)
 #define ZONETABLE_MASK		((1UL << ZONETABLE_SHIFT) - 1)
 
-static inline zones_t page_zonenum(struct page *page)
+static inline enum zone_type page_zonenum(struct page *page)
 {
 	return (page->flags >> ZONES_PGSHIFT) & ZONES_MASK;
 }
@@ -498,7 +498,7 @@ static inline unsigned long page_to_sect
 	return (page->flags >> SECTIONS_PGSHIFT) & SECTIONS_MASK;
 }
 
-static inline void set_page_zone(struct page *page, zones_t zone)
+static inline void set_page_zone(struct page *page, enum zone_type zone)
 {
 	page->flags &= ~(ZONES_MASK << ZONES_PGSHIFT);
 	page->flags |= (zone & ZONES_MASK) << ZONES_PGSHIFT;
@@ -515,7 +515,7 @@ static inline void set_page_section(stru
 	page->flags |= (section & SECTIONS_MASK) << SECTIONS_PGSHIFT;
 }
 
-static inline void set_page_links(struct page *page, zones_t zone,
+static inline void set_page_links(struct page *page, enum zone_type zone,
 	unsigned long node, unsigned long pfn)
 {
 	set_page_zone(page, zone);
diff -puN include/linux/mmzone.h~reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment-cleanup include/linux/mmzone.h
--- a/include/linux/mmzone.h~reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment-cleanup
+++ a/include/linux/mmzone.h
@@ -87,7 +87,7 @@ struct per_cpu_pageset {
 #define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
 #endif
 
-typedef enum {
+enum zone_type {
 	/*
 	 * ZONE_DMA is used when there are devices that are not able
 	 * to do DMA to all of addressable memory (ZONE_NORMAL). Then we
@@ -131,7 +131,7 @@ typedef enum {
 	ZONE_HIGHMEM,
 
 	MAX_NR_ZONES
-} zones_t;
+};
 
 #define	ZONES_SHIFT		2	/* ceil(log2(MAX_NR_ZONES)) */
 
@@ -400,12 +400,12 @@ static inline int populated_zone(struct 
 	return (!!zone->present_pages);
 }
 
-static inline int is_highmem_idx(zones_t idx)
+static inline int is_highmem_idx(enum zone_type idx)
 {
 	return (idx == ZONE_HIGHMEM);
 }
 
-static inline int is_normal_idx(zones_t idx)
+static inline int is_normal_idx(enum zone_type idx)
 {
 	return (idx == ZONE_NORMAL);
 }
diff -puN mm/page_alloc.c~reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment-cleanup mm/page_alloc.c
--- a/mm/page_alloc.c~reduce-max_nr_zones-use-enum-to-define-zones-reformat-and-comment-cleanup
+++ a/mm/page_alloc.c
@@ -1498,7 +1498,8 @@ static void __meminit build_zonelists(pg
 static void __meminit build_zonelists(pg_data_t *pgdat)
 {
 	int i, node, local_node;
-	zones_t k,j;
+	enum zone_type k;
+	enum zone_type j;
 
 	local_node = pgdat->node_id;
 	for (i = 0; i < GFP_ZONETYPES; i++) {
@@ -1686,7 +1687,7 @@ void zone_init_free_lists(struct pglist_
 }
 
 #define ZONETABLE_INDEX(x, zone_nr)	((x << ZONES_SHIFT) | zone_nr)
-void zonetable_add(struct zone *zone, int nid, zones_t zid,
+void zonetable_add(struct zone *zone, int nid, enum zone_type zid,
 		unsigned long pfn, unsigned long size)
 {
 	unsigned long snum = pfn_to_section_nr(pfn);
@@ -1969,7 +1970,7 @@ __meminit int init_currently_empty_zone(
 static void __meminit free_area_init_core(struct pglist_data *pgdat,
 		unsigned long *zones_size, unsigned long *zholes_size)
 {
-	zones_t j;
+	enum zone_type j;
 	int nid = pgdat->node_id;
 	unsigned long zone_start_pfn = pgdat->node_start_pfn;
 	int ret;
_


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

end of thread, other threads:[~2006-07-08  0:52 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-07 23:18 [PATCH 00/11] Reduce MAX_NR_ZONES V1 Christoph Lameter
2006-07-07 23:18 ` [PATCH 01/11] swap_prefetch: Remove incorrect use of ZONE_HIGHMEM Christoph Lameter
2006-07-07 23:18 ` [PATCH 02/11] Remove two strange uses of MAX_NR_ZONES Christoph Lameter
2006-07-07 23:18 ` [PATCH 03/11] Fix MAX_NR_ZONES array initializations Christoph Lameter
2006-07-07 23:18 ` [PATCH 04/11] Make display of highmem counters conditional on CONFIG_HIGHMEM Christoph Lameter
2006-07-07 23:18 ` [PATCH 05/11] Move HIGHMEM counters into highmem.c/.h Christoph Lameter
2006-07-07 23:18 ` [PATCH 06/11] Page allocator ZONE_HIGHMEM cleanup Christoph Lameter
2006-07-07 23:18 ` [PATCH 07/11] Use enum to define zones, reformat and comment Christoph Lameter
2006-07-08  0:56   ` Andrew Morton
2006-07-07 23:18 ` [PATCH 08/11] Make ZONE_DMA32 optional Christoph Lameter
2006-07-07 23:18 ` [PATCH 09/11] Make ZONE_HIGHMEM optional Christoph Lameter
2006-07-07 23:19 ` [PATCH 10/11] Remove display of counters for unconfigured zones Christoph Lameter
2006-07-07 23:19 ` [PATCH 11/11] Fix i386 SRAT check for MAX_NR_ZONES Christoph Lameter

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.