All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC 0/8] Optional ZONE_DMA
@ 2006-07-08  0:05 Christoph Lameter
  2006-07-08  0:05 ` [RFC 1/8] Add CONFIG_ZONE_DMA to all archesM Christoph Lameter
                   ` (7 more replies)
  0 siblings, 8 replies; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  0:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Nick Piggin, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Martin Bligh, Christoph Lameter,
	KAMEZAWA Hiroyuki, Andi Kleen

Optional ZONE_DMA

ZONE_DMA is usually used for ISA DMA devices. Typically modern hardware
does not have any of these anymore. We frequently do not need
the zone anymore.

This patch allows to make the configuration of the kernel for
ZONE_DMA dependend on the user choosing to support ISA DMA.
If ISA DMA is not supported then i386 systems f.e. can be
configured using a single ZONE_NORMAL. The overhead of maintaining
multiple zones and balancing page use between the different
zone is then gone. My i386 system now runs with a single zone.

On x86_64 systems also usually we do not need ZONE_DMA since there
are barely any ISA DMA devices around (or are you still using a floppy?).
So for most cases the zone can be dropped. Also if the x86_64 systems
has less than 4G RAM or DMA controllers that actually can do 64 bit
then we also do not need ZONE_DMA32. My x86_64 system has 1G of
memory therefore I can run with a single zone.

SGI's ia64 systems only use one zone. A numa system with a single
zone will have one zone per node which makes the association between
nodes and zones simpler.

This patchset is build on top of the "Reduce Zones" patchset V1 that was
posted earlier today. It will make ZONE_DMA configurable like
the other zones. Then it introduces a SINGLE_ZONE macro that is set
if the system has only a single zone.

Single zone systems do no need the loops over all zones. We can also return
constants for a lot of important VM macros. Finally the policy zone
determination in the mempolicy layer becomes trivial.

Note that this is an RFC only. In order for this to work cleanly we need to
mark all device drives according to what type of DMA controller they support.
If its a ISA DMA controller then we would need to enable ZONE_DMA. If its
a 32 bit controller and we support >4G of memory then we need to enable ZONE_DMA32.

This was tested on i386 and x86_64 in UP and SMP mode.


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

* [RFC 1/8] Add CONFIG_ZONE_DMA to all archesM
  2006-07-08  0:05 [RFC 0/8] Optional ZONE_DMA Christoph Lameter
@ 2006-07-08  0:05 ` Christoph Lameter
  2006-07-10  0:52   ` KAMEZAWA Hiroyuki
  2006-07-08  0:05 ` [RFC 2/8] slab allocator: Make DMA support configurable Christoph Lameter
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  0:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Martin Bligh, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Nick Piggin, Christoph Lameter, Andi Kleen,
	KAMEZAWA Hiroyuki

Introduce CONFIG_ZONE_DMA

CONFIG_ZONE_DMA can be defined in two ways depending on how
an architecture handles ISA DMA.

First when CONFIG_GENERIC_ISA_DMA is set by the arch then we know that
the arch needs ZONE_DMA because ISA DMA devices are supported. The arch
would need to be modified in order to allow switching ZONE_DMA off.

Second, arches may use ZONE_DMA in an unknown way. We set CONFIG_ZONE_DMA
for all arches that do not set CONFIG_GENERIC_ISA_DMA in order to insure
backwards compatibility. The arches may later undefine ZONE_DMA
if their arch code has been modified to not depend on ZONE_DMA.

As a result of this patch CONFIG_ZONE_DMA should be defined for every
arch.

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

Index: linux-2.6.17-mm6/mm/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/mm/Kconfig	2006-07-03 13:47:22.616084772 -0700
+++ linux-2.6.17-mm6/mm/Kconfig	2006-07-03 21:26:49.956038556 -0700
@@ -134,6 +134,10 @@ config SPLIT_PTLOCK_CPUS
 	default "4096" if PARISC && !PA20
 	default "4"
 
+config ZONE_DMA
+	def_bool y
+	depends on GENERIC_ISA_DMA
+
 #
 # support for page migration
 #
Index: linux-2.6.17-mm6/arch/ia64/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/ia64/Kconfig	2006-07-03 21:26:38.944998185 -0700
+++ linux-2.6.17-mm6/arch/ia64/Kconfig	2006-07-03 21:35:54.270151176 -0700
@@ -22,6 +22,10 @@ config 64BIT
 	bool
 	default y
 
+config ZONE_DMA
+	bool
+	default y
+
 config MMU
 	bool
 	default y
Index: linux-2.6.17-mm6/arch/cris/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/cris/Kconfig	2006-07-03 13:47:12.502452440 -0700
+++ linux-2.6.17-mm6/arch/cris/Kconfig	2006-07-03 21:34:53.678182903 -0700
@@ -9,6 +9,10 @@ config MMU
 	bool
 	default y
 
+config ZONE_DMA
+	bool
+	default y
+
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
Index: linux-2.6.17-mm6/arch/s390/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/s390/Kconfig	2006-07-03 13:47:13.887132430 -0700
+++ linux-2.6.17-mm6/arch/s390/Kconfig	2006-07-03 21:34:30.527266107 -0700
@@ -7,6 +7,10 @@ config MMU
 	bool
 	default y
 
+config ZONE_DMA
+	bool
+	default y
+
 config LOCKDEP_SUPPORT
 	bool
 	default y
Index: linux-2.6.17-mm6/arch/xtensa/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/xtensa/Kconfig	2006-07-03 13:47:14.333393893 -0700
+++ linux-2.6.17-mm6/arch/xtensa/Kconfig	2006-07-03 21:37:26.980256509 -0700
@@ -7,6 +7,10 @@ config FRAME_POINTER
 	bool
 	default n
 
+config ZONE_DMA
+	bool
+	default y
+
 config XTENSA
 	bool
 	default y
Index: linux-2.6.17-mm6/arch/h8300/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/h8300/Kconfig	2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-mm6/arch/h8300/Kconfig	2006-07-03 21:35:38.346328043 -0700
@@ -17,6 +17,10 @@ config SWAP
 	bool
 	default n
 
+config ZONE_DMA
+	bool
+	default y
+
 config FPU
 	bool
 	default n
Index: linux-2.6.17-mm6/arch/v850/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/v850/Kconfig	2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-mm6/arch/v850/Kconfig	2006-07-03 21:37:04.602729732 -0700
@@ -10,6 +10,9 @@ mainmenu "uClinux/v850 (w/o MMU) Kernel 
 config MMU
        	bool
 	default n
+config ZONE_DMA
+	bool
+	default y
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
Index: linux-2.6.17-mm6/arch/sh/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/sh/Kconfig	2006-07-03 13:47:13.975017619 -0700
+++ linux-2.6.17-mm6/arch/sh/Kconfig	2006-07-03 21:36:39.118949095 -0700
@@ -14,6 +14,10 @@ config SUPERH
 	  gaming console.  The SuperH port has a home page at
 	  <http://www.linux-sh.org/>.
 
+config ZONE_DMA
+	bool
+	default y
+
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
Index: linux-2.6.17-mm6/arch/frv/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/frv/Kconfig	2006-06-17 18:49:35.000000000 -0700
+++ linux-2.6.17-mm6/arch/frv/Kconfig	2006-07-03 21:35:16.328153984 -0700
@@ -6,6 +6,10 @@ config FRV
 	bool
 	default y
 
+config ZONE_DMA
+	bool
+	default y
+
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y
Index: linux-2.6.17-mm6/arch/m68knommu/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/m68knommu/Kconfig	2006-07-03 13:47:12.932113368 -0700
+++ linux-2.6.17-mm6/arch/m68knommu/Kconfig	2006-07-03 21:36:19.860370626 -0700
@@ -17,6 +17,10 @@ config FPU
 	bool
 	default n
 
+config ZONE_DMA
+	bool
+	default y
+
 config RWSEM_GENERIC_SPINLOCK
 	bool
 	default y

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

* [RFC 2/8] slab allocator: Make DMA support configurable
  2006-07-08  0:05 [RFC 0/8] Optional ZONE_DMA Christoph Lameter
  2006-07-08  0:05 ` [RFC 1/8] Add CONFIG_ZONE_DMA to all archesM Christoph Lameter
@ 2006-07-08  0:05 ` Christoph Lameter
  2006-07-08  0:05 ` [RFC 3/8] eventcounters: Optional ZONE_DMA Christoph Lameter
                   ` (5 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  0:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Nick Piggin, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Martin Bligh, Christoph Lameter,
	KAMEZAWA Hiroyuki, Andi Kleen

Support slab without ZONE_SLAB.

If CONFIG_ZONE_DMA is not defined then drop support for ZONE_DMA from
the slab allocator.

Do not create the special DMA slab series for kmalloc and always
return memory from ZONE_NORMAL.

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

Index: linux-2.6.17-mm6/mm/slab.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/slab.c	2006-07-03 13:47:22.651238848 -0700
+++ linux-2.6.17-mm6/mm/slab.c	2006-07-03 21:39:07.050259199 -0700
@@ -650,11 +650,17 @@ EXPORT_SYMBOL(malloc_sizes);
 /* Must match cache_sizes above. Out of line to keep cache footprint low. */
 struct cache_names {
 	char *name;
+#ifdef CONFIG_ZONE_DMA
 	char *name_dma;
+#endif
 };
 
 static struct cache_names __initdata cache_names[] = {
+#ifdef CONFIG_ZONE_DMA
 #define CACHE(x) { .name = "size-" #x, .name_dma = "size-" #x "(DMA)" },
+#else
+#define CACHE(x) { .name = "size-" #x },
+#endif
 #include <linux/kmalloc_sizes.h>
 	{NULL,}
 #undef CACHE
@@ -729,7 +735,7 @@ static inline struct kmem_cache *__find_
 #endif
 	while (size > csizep->cs_size)
 		csizep++;
-
+#ifdef CONFIG_ZONE_DMA
 	/*
 	 * Really subtle: The last entry with cs->cs_size==ULONG_MAX
 	 * has cs_{dma,}cachep==NULL. Thus no special case
@@ -737,6 +743,7 @@ static inline struct kmem_cache *__find_
 	 */
 	if (unlikely(gfpflags & GFP_DMA))
 		return csizep->cs_dmacachep;
+#endif
 	return csizep->cs_cachep;
 }
 
@@ -1395,13 +1402,14 @@ void __init kmem_cache_init(void)
 					ARCH_KMALLOC_FLAGS|SLAB_PANIC,
 					NULL, NULL);
 		}
-
+#ifdef CONFIG_ZONE_DMA
 		sizes->cs_dmacachep = kmem_cache_create(names->name_dma,
 					sizes->cs_size,
 					ARCH_KMALLOC_MINALIGN,
 					ARCH_KMALLOC_FLAGS|SLAB_CACHE_DMA|
 						SLAB_PANIC,
 					NULL, NULL);
+#endif
 		sizes++;
 		names++;
 	}
@@ -2179,8 +2187,10 @@ kmem_cache_create (const char *name, siz
 	cachep->slab_size = slab_size;
 	cachep->flags = flags;
 	cachep->gfpflags = 0;
+#ifdef CONFIG_ZONE_DMA
 	if (flags & SLAB_CACHE_DMA)
 		cachep->gfpflags |= GFP_DMA;
+#endif
 	cachep->buffer_size = size;
 
 	if (flags & CFLGS_OFF_SLAB)
@@ -2498,10 +2508,12 @@ static void cache_init_objs(struct kmem_
 
 static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags)
 {
+#ifdef CONFIG_ZONE_DMA
 	if (flags & SLAB_DMA)
 		BUG_ON(!(cachep->gfpflags & GFP_DMA));
 	else
 		BUG_ON(cachep->gfpflags & GFP_DMA);
+#endif
 }
 
 static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp,
Index: linux-2.6.17-mm6/include/linux/slab.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/slab.h	2006-07-03 21:27:34.756012776 -0700
+++ linux-2.6.17-mm6/include/linux/slab.h	2006-07-03 22:07:16.857980432 -0700
@@ -72,7 +72,9 @@ extern const char *kmem_cache_name(kmem_
 struct cache_sizes {
 	size_t		 cs_size;
 	kmem_cache_t	*cs_cachep;
+#ifdef CONFIG_ZONE_DMA
 	kmem_cache_t	*cs_dmacachep;
+#endif
 };
 extern struct cache_sizes malloc_sizes[];
 
@@ -146,9 +148,13 @@ static inline void *kmalloc(size_t size,
 			__you_cannot_kmalloc_that_much();
 		}
 found:
+#ifdef CONFIG_ZONE_DMA
 		return kmem_cache_alloc((flags & GFP_DMA) ?
 			malloc_sizes[i].cs_dmacachep :
 			malloc_sizes[i].cs_cachep, flags);
+#else
+		return kmem_cache_alloc(malloc_sizes[i].cs_cachep, flags);
+#endif
 	}
 	return __kmalloc(size, flags);
 }
@@ -176,9 +182,13 @@ static inline void *kzalloc(size_t size,
 			__you_cannot_kzalloc_that_much();
 		}
 found:
+#ifdef CONFIG_ZONE_DMA
 		return kmem_cache_zalloc((flags & GFP_DMA) ?
 			malloc_sizes[i].cs_dmacachep :
 			malloc_sizes[i].cs_cachep, flags);
+#else
+		return kmem_cache_zalloc(malloc_sizes[i].cs_cachep, flags);
+#endif
 	}
 	return __kzalloc(size, flags);
 }

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

* [RFC 3/8] eventcounters: Optional ZONE_DMA
  2006-07-08  0:05 [RFC 0/8] Optional ZONE_DMA Christoph Lameter
  2006-07-08  0:05 ` [RFC 1/8] Add CONFIG_ZONE_DMA to all archesM Christoph Lameter
  2006-07-08  0:05 ` [RFC 2/8] slab allocator: Make DMA support configurable Christoph Lameter
@ 2006-07-08  0:05 ` Christoph Lameter
  2006-07-08  0:05 ` [RFC 4/8] page allocator: " Christoph Lameter
                   ` (4 subsequent siblings)
  7 siblings, 0 replies; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  0:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Martin Bligh, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Nick Piggin, Christoph Lameter, Andi Kleen,
	KAMEZAWA Hiroyuki

vmstat: Make ZONE_DMA support configurable

Do not display ZONE_DMA counters if no DMA zone is available.

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-06 18:44:59.763286559 -0700
+++ linux-2.6.17-mm6/include/linux/vmstat.h	2006-07-06 19:59:53.254972797 -0700
@@ -18,6 +18,12 @@
  * generated will simply be the increment of a global address.
  */
 
+#ifdef CONFIG_ZONE_DMA
+#define DMA_ZONE(xx) xx##_DMA,
+#else
+#define DMA_ZONE(xx)
+#endif
+
 #ifdef CONFIG_ZONE_DMA32
 #define DMA32_ZONE(xx) xx##_DMA32,
 #else
@@ -30,7 +36,7 @@
 #define HIGHMEM_ZONE(xx)
 #endif
 
-#define FOR_ALL_ZONES(xx) xx##_DMA, DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx)
+#define FOR_ALL_ZONES(xx) DMA_ZONE(xx) DMA32_ZONE(xx) xx##_NORMAL HIGHMEM_ZONE(xx)
 
 enum vm_event_item { PGPGIN, PGPGOUT, PSWPIN, PSWPOUT,
 		FOR_ALL_ZONES(PGALLOC),
@@ -88,9 +94,13 @@ extern void vm_events_fold_cpu(int cpu);
 
 #endif /* CONFIG_VM_EVENT_COUNTERS */
 
+#ifdef CONFIG_ZONE_DMA
 #define __count_zone_vm_events(item, zone, delta) \
 			__count_vm_events(item##_DMA + zone_idx(zone), delta)
-
+#else
+#define __count_zone_vm_events(item, zone, delta) \
+			__count_vm_events(item##_NORMAL + zone_idx(zone), delta)
+#endif
 /*
  * Zone based page accounting with per cpu differentials.
  */
@@ -136,14 +146,16 @@ static inline unsigned long node_page_st
 	struct zone *zones = NODE_DATA(node)->node_zones;
 
 	return
+#ifdef CONFIG_ZONE_DMA
+		zone_page_state(&zones[ZONE_DMA], item) +
+#endif
 #ifdef CONFIG_ZONE_DMA32
 		zone_page_state(&zones[ZONE_DMA32], item) +
 #endif
-		zone_page_state(&zones[ZONE_NORMAL], item) +
 #ifdef CONFIG_HIGHMEM
 		zone_page_state(&zones[ZONE_HIGHMEM], item) +
 #endif
-		zone_page_state(&zones[ZONE_DMA], item);
+		zone_page_state(&zones[ZONE_NORMAL], item);
 }
 
 extern void zone_statistics(struct zonelist *, struct zone *);
Index: linux-2.6.17-mm6/mm/vmstat.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/vmstat.c	2006-07-06 18:44:59.764263061 -0700
+++ linux-2.6.17-mm6/mm/vmstat.c	2006-07-06 22:32:29.382408873 -0700
@@ -381,6 +381,12 @@ struct seq_operations fragmentation_op =
 	.show	= frag_show,
 };
 
+#ifdef CONFIG_ZONE_DMA
+#define TEXT_FOR_DMA(xx) xx "_dma",
+#else
+#define TEXT_FOR_DMA(xx)
+#endif
+
 #ifdef CONFIG_ZONE_DMA32
 #define TEXT_FOR_DMA32(xx) xx "_dma32",
 #else
@@ -393,7 +399,7 @@ struct seq_operations fragmentation_op =
 #define TEXT_FOR_HIGHMEM(xx)
 #endif
 
-#define TEXTS_FOR_ZONES(xx) xx "_dma", TEXT_FOR_DMA32(xx) xx "_normal", \
+#define TEXTS_FOR_ZONES(xx) TEXT_FOR_DMA(xx) TEXT_FOR_DMA32(xx) xx "_normal", \
 					TEXT_FOR_HIGHMEM(xx)
 
 static char *vmstat_text[] = {

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

* [RFC 4/8] page allocator: Optional ZONE_DMA
  2006-07-08  0:05 [RFC 0/8] Optional ZONE_DMA Christoph Lameter
                   ` (2 preceding siblings ...)
  2006-07-08  0:05 ` [RFC 3/8] eventcounters: Optional ZONE_DMA Christoph Lameter
@ 2006-07-08  0:05 ` Christoph Lameter
  2006-07-08  0:23   ` Andi Kleen
  2006-07-08  0:05 ` [RFC 5/8] x86_64 without ZONE_DMA Christoph Lameter
                   ` (3 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  0:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Nick Piggin, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Martin Bligh, Christoph Lameter,
	KAMEZAWA Hiroyuki, Andi Kleen

Make ZONE_DMA optional in the page allocator

- ifdef all code for ZONE_DMA and related definitions.

- Without ZONE_DMA, ZONE_HIGHMEM and ZONE_DMA32 we fall back
  to an empty GFP_ZONEMASK and a ZONES_SHIFT of zero (since there
  is only one zone....).

- We need to fix the use of ZONE_DMA in the memory policy layer.
  ZONE_DMA is used there as the first zone so use 0 instead.

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-07 15:29:50.265384678 -0700
+++ linux-2.6.17-mm6/include/linux/mmzone.h	2006-07-07 16:44:03.067357437 -0700
@@ -88,6 +88,7 @@ struct per_cpu_pageset {
 #endif
 
 typedef enum {
+#ifdef CONFIG_ZONE_DMA
 	/*
 	 * ZONE_DMA is used when there are devices that are not able
 	 * to do DMA to all of addressable memory (ZONE_NORMAL). Then we
@@ -108,6 +109,7 @@ typedef enum {
 	 * 			<16M.
 	 */
 	ZONE_DMA,
+#endif
 #ifdef CONFIG_ZONE_DMA32
 	/*
 	 * x86_64 needs two ZONE_DMAs because it supports devices that are
@@ -172,8 +174,13 @@ typedef enum {
 #define GFP_ZONEMASK		0x03
 #define	ZONES_SHIFT		2
 #else
+#ifdef CONFIG_DMA
 #define GFP_ZONEMASK		0x01
 #define ZONES_SHIFT		1
+#else
+#define GFP_ZONEMASK		0x00
+#define ZONES_SHIFT		0
+#endif
 #endif
 #endif
 
@@ -464,7 +471,11 @@ static inline int is_dma32(struct zone *
 
 static inline int is_dma(struct zone *zone)
 {
+#ifdef CONFIG_ZONE_DMA
 	return zone == zone->zone_pgdat->node_zones + ZONE_DMA;
+#else
+	return 0;
+#endif
 }
 
 /* These two functions are used to setup the per zone pages min values */
Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c	2006-07-07 15:29:50.265384678 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c	2006-07-07 16:44:03.069310441 -0700
@@ -69,7 +69,9 @@ static void __free_pages_ok(struct page 
  * don't need any ZONE_NORMAL reservation
  */
 int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
+#ifdef CONFIG_ZONE_DMA
 	 256,
+#endif
 #ifdef CONFIG_ZONE_DMA32
 	 256,
 #endif
@@ -88,7 +90,9 @@ struct zone *zone_table[1 << ZONETABLE_S
 EXPORT_SYMBOL(zone_table);
 
 static char *zone_names[MAX_NR_ZONES] = {
+#ifdef CONFIG_ZONE_DMA
 	 "DMA",
+#endif
 #ifdef CONFIG_ZONE_DMA32
 	 "DMA32",
 #endif
@@ -1485,8 +1489,10 @@ static inline int highest_zone(int zone_
 	if (zone_bits & (__force int)__GFP_DMA32)
 		res = ZONE_DMA32;
 #endif
+#ifdef CONFIG_ZONE_DMA
 	if (zone_bits & (__force int)__GFP_DMA)
 		res = ZONE_DMA;
+#endif
 	return res;
 }
 
Index: linux-2.6.17-mm6/mm/mempolicy.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/mempolicy.c	2006-07-06 11:46:23.152072668 -0700
+++ linux-2.6.17-mm6/mm/mempolicy.c	2006-07-07 16:44:03.070286943 -0700
@@ -105,7 +105,7 @@ static struct kmem_cache *sn_cache;
 
 /* Highest zone. An specific allocation for a zone below that is not
    policied. */
-int policy_zone = ZONE_DMA;
+int policy_zone = 0;
 
 struct mempolicy default_policy = {
 	.refcnt = ATOMIC_INIT(1), /* never free it */

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

* [RFC 5/8] x86_64 without ZONE_DMA
  2006-07-08  0:05 [RFC 0/8] Optional ZONE_DMA Christoph Lameter
                   ` (3 preceding siblings ...)
  2006-07-08  0:05 ` [RFC 4/8] page allocator: " Christoph Lameter
@ 2006-07-08  0:05 ` Christoph Lameter
  2006-07-08  0:20   ` Andi Kleen
  2006-07-08  0:05 ` [RFC 6/8] i386 " Christoph Lameter
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  0:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Martin Bligh, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Nick Piggin, Christoph Lameter, Andi Kleen,
	KAMEZAWA Hiroyuki

x86_64: ZONE_DMA/ZONE_DMA32 optional

Allow the use to specify CONFIG_ZONE_DMA32 and CONFIG_ZONE_DMA (via
CONFIG_GENERIC_ISA_DMA).

Not that this is incomplete. What really needs to occur is that
devices using ISA DMA need to depend on ZONE_DMA.

I am also not sure if this works for all configuration. Works fine
on my desktop x86_64 system with a single zone.

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-07 01:13:06.000000000 -0700
+++ linux-2.6.17-mm6/arch/x86_64/mm/init.c	2006-07-07 01:13:14.000000000 -0700
@@ -413,15 +413,18 @@
 
  	for (i = 0; i < MAX_NR_ZONES; i++)
  		z[i] = 0;
-
+#ifdef CONFIG_ZONE_DMA
  	if (start_pfn < MAX_DMA_PFN)
  		z[ZONE_DMA] = MAX_DMA_PFN - start_pfn;
+#endif
+#ifdef CONFIG_ZONE_DMA32
  	if (start_pfn < MAX_DMA32_PFN) {
  		unsigned long dma32_pfn = MAX_DMA32_PFN;
  		if (dma32_pfn > end_pfn)
  			dma32_pfn = end_pfn;
  		z[ZONE_DMA32] = dma32_pfn - start_pfn;
  	}
+#endif
  	z[ZONE_NORMAL] = end_pfn - start_pfn;
 
  	/* Remove lower zones from higher ones. */
@@ -444,14 +447,14 @@
 	for (i = 0; i < MAX_NR_ZONES; i++)
 		h[i] += (z[i] * sizeof(struct page)) / PAGE_SIZE;
 
-	/* The 16MB DMA zone has the kernel and other misc mappings.
+	/* The first zone has the kernel and other misc mappings.
  	   Account them too */
-	if (h[ZONE_DMA]) {
-		h[ZONE_DMA] += dma_reserve;
-		if (h[ZONE_DMA] >= z[ZONE_DMA]) {
+	if (h[0]) {
+		h[0] += dma_reserve;
+		if (h[0] >= z[0]) {
 			printk(KERN_WARNING
-				"Kernel too large and filling up ZONE_DMA?\n");
-			h[ZONE_DMA] = z[ZONE_DMA];
+				"Kernel too large and filling up first zone?\n");
+			h[0] = z[0];
 		}
 	}
 }
Index: linux-2.6.17-mm6/arch/x86_64/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/x86_64/Kconfig	2006-07-07 01:13:08.000000000 -0700
+++ linux-2.6.17-mm6/arch/x86_64/Kconfig	2006-07-07 01:13:14.000000000 -0700
@@ -24,10 +24,6 @@
 	bool
 	default y
 
-config ZONE_DMA32
-	bool
-	default y
-
 config LOCKDEP_SUPPORT
 	bool
 	default y
@@ -73,10 +69,6 @@
 	bool
 	default y
 
-config GENERIC_ISA_DMA
-	bool
-	default y
-
 config GENERIC_IOMAP
 	bool
 	default y
@@ -247,6 +239,23 @@
 
 	  See <file:Documentation/mtrr.txt> for more information.
 
+config ZONE_DMA32
+	bool "32 Bit DMA Zone (only needed if memory >4GB)"
+	default y
+	help
+	  Some x64 configurations have 32 bit DMA controllers that cannot
+	  write to all of memory. If you have one of these and you have RAM
+	  beyond the 4GB boundary then enable this option.
+
+config GENERIC_ISA_DMA
+	bool "ISA DMA zone (to support ISA legacy DMA)"
+	default y
+	help
+	  If DMA for ISA boards needs to be supported then this option
+	  needs to be enabled. An additional DMA zone for <16MB memory
+	  will be created and memory below 16MB will be used for those
+	  devices.
+
 config SMP
 	bool "Symmetric multi-processing support"
 	---help---
Index: linux-2.6.17-mm6/arch/x86_64/kernel/Makefile
===================================================================
--- linux-2.6.17-mm6.orig/arch/x86_64/kernel/Makefile	2006-07-07 01:13:22.000000000 -0700
+++ linux-2.6.17-mm6/arch/x86_64/kernel/Makefile	2006-07-07 01:13:47.000000000 -0700
@@ -7,9 +7,10 @@
 obj-y	:= process.o signal.o entry.o traps.o irq.o \
 		ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_x86_64.o \
 		x8664_ksyms.o i387.o syscall.o vsyscall.o \
-		setup64.o bootflag.o e820.o reboot.o quirks.o i8237.o \
+		setup64.o bootflag.o e820.o reboot.o quirks.o \
 		pci-dma.o pci-nommu.o alternative.o
 
+obj-$(CONFIG_GENERIC_ISA_DMA)	+= i8237.o
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 obj-$(CONFIG_X86_MCE)         += mce.o
 obj-$(CONFIG_X86_MCE_INTEL)	+= mce_intel.o

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

* [RFC 6/8] i386 without ZONE_DMA
  2006-07-08  0:05 [RFC 0/8] Optional ZONE_DMA Christoph Lameter
                   ` (4 preceding siblings ...)
  2006-07-08  0:05 ` [RFC 5/8] x86_64 without ZONE_DMA Christoph Lameter
@ 2006-07-08  0:05 ` Christoph Lameter
  2006-07-08  0:05 ` [RFC 7/8] Single zone optimizations Christoph Lameter
  2006-07-08  0:05 ` [RFC 8/8] Optimize mempolicies for a single zone Christoph Lameter
  7 siblings, 0 replies; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  0:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Nick Piggin, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Martin Bligh, Christoph Lameter,
	KAMEZAWA Hiroyuki, Andi Kleen

i386: Optional ZONE_DMA

ZONE_DMA depends on GENERIC_ISA_DMA. We allow the user to configure
GENERIC_ISA_DMA. If it is switched off then we buid a kernel without
ZONE_DMA.

Note that this patch is incomplete: All device drivers that use GENERIC_ISA_DMA
need to depend on it. This was not tested for i386 NUMA and other miscalleneous
configuration. But it works on my desktop (dual core Pentium).

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

Index: linux-2.6.17-mm6/arch/i386/kernel/setup.c
===================================================================
--- linux-2.6.17-mm6.orig/arch/i386/kernel/setup.c	2006-07-07 09:01:12.000000000 -0700
+++ linux-2.6.17-mm6/arch/i386/kernel/setup.c	2006-07-07 16:21:53.000000000 -0700
@@ -1207,15 +1207,19 @@ void __init zone_sizes_init(void)
 	max_dma = virt_to_phys((char *)MAX_DMA_ADDRESS) >> PAGE_SHIFT;
 	low = max_low_pfn;
 
+#ifdef CONFIG_ZONE_DMA
 	if (low < max_dma)
 		zones_size[ZONE_DMA] = low;
 	else {
 		zones_size[ZONE_DMA] = max_dma;
 		zones_size[ZONE_NORMAL] = low - max_dma;
+	}
+#else
+	zones_size[ZONE_NORMAL] = low;
+#endif
 #ifdef CONFIG_HIGHMEM
-		zones_size[ZONE_HIGHMEM] = highend_pfn - low;
+	zones_size[ZONE_HIGHMEM] = highend_pfn - low;
 #endif
-	}
 	free_area_init(zones_size);
 }
 #else
Index: linux-2.6.17-mm6/arch/i386/Kconfig
===================================================================
--- linux-2.6.17-mm6.orig/arch/i386/Kconfig	2006-07-07 16:15:10.000000000 -0700
+++ linux-2.6.17-mm6/arch/i386/Kconfig	2006-07-07 16:18:57.000000000 -0700
@@ -41,10 +41,6 @@ config MMU
 config SBUS
 	bool
 
-config GENERIC_ISA_DMA
-	bool
-	default y
-
 config GENERIC_IOMAP
 	bool
 	default y
@@ -344,6 +340,15 @@ config VM86
           XFree86 to initialize some video cards via BIOS. Disabling this
           option saves about 6k.
 
+config GENERIC_ISA_DMA
+	bool "ISA DMA zone (to support ISA legacy DMA)"
+	default y
+	help
+	  If DMA for ISA boards needs to be supported then this option
+	  needs to be enabled. An additional DMA zone for <16MB memory
+	  will be created and memory below 16MB will be used for those
+	  devices.
+
 config TOSHIBA
 	tristate "Toshiba Laptop support"
 	---help---
Index: linux-2.6.17-mm6/arch/i386/kernel/Makefile
===================================================================
--- linux-2.6.17-mm6.orig/arch/i386/kernel/Makefile	2006-07-07 16:16:19.000000000 -0700
+++ linux-2.6.17-mm6/arch/i386/kernel/Makefile	2006-07-07 16:17:16.000000000 -0700
@@ -7,8 +7,9 @@ extra-y := head.o init_task.o vmlinux.ld
 obj-y	:= process.o semaphore.o signal.o entry.o traps.o irq.o \
 		ptrace.o time.o ioport.o ldt.o setup.o i8259.o sys_i386.o \
 		pci-dma.o i386_ksyms.o i387.o bootflag.o \
-		quirks.o i8237.o topology.o alternative.o i8253.o tsc.o
+		quirks.o topology.o alternative.o i8253.o tsc.o
 
+obj-$(CONFIG_GENERIC_ISA_DMA)	+= i8237.o
 obj-$(CONFIG_STACKTRACE)	+= stacktrace.o
 obj-y				+= cpu/
 obj-y				+= acpi/

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

* [RFC 7/8] Single zone optimizations
  2006-07-08  0:05 [RFC 0/8] Optional ZONE_DMA Christoph Lameter
                   ` (5 preceding siblings ...)
  2006-07-08  0:05 ` [RFC 6/8] i386 " Christoph Lameter
@ 2006-07-08  0:05 ` Christoph Lameter
  2006-07-08  0:19   ` Andi Kleen
  2006-07-08  0:05 ` [RFC 8/8] Optimize mempolicies for a single zone Christoph Lameter
  7 siblings, 1 reply; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  0:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Martin Bligh, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Nick Piggin, Christoph Lameter, Andi Kleen,
	KAMEZAWA Hiroyuki

Single Zone Optimizations

If we only have a single zone then various macros can be optimized.

We do not need to protect higher zones etc etc.

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

Index: linux-2.6.17-mm6/mm/vmstat.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/vmstat.c	2006-07-07 16:50:18.434774588 -0700
+++ linux-2.6.17-mm6/mm/vmstat.c	2006-07-07 16:51:50.428110300 -0700
@@ -496,7 +496,7 @@ static int zoneinfo_show(struct seq_file
 		for (i = 0; i < NR_VM_ZONE_STAT_ITEMS; i++)
 			seq_printf(m, "\n    %-12s %lu", vmstat_text[i],
 					zone_page_state(zone, i));
-
+#ifndef SINGLE_ZONE
 		seq_printf(m,
 			   "\n        protection: (%lu",
 			   zone->lowmem_reserve[0]);
@@ -505,6 +505,7 @@ static int zoneinfo_show(struct seq_file
 		seq_printf(m,
 			   ")"
 			   "\n  pagesets");
+#endif
 		for_each_online_cpu(i) {
 			struct per_cpu_pageset *pageset;
 			int j;
Index: linux-2.6.17-mm6/mm/page_alloc.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/page_alloc.c	2006-07-07 16:50:18.788268357 -0700
+++ linux-2.6.17-mm6/mm/page_alloc.c	2006-07-07 16:51:50.430063305 -0700
@@ -57,6 +57,7 @@ int percpu_pagelist_fraction;
 
 static void __free_pages_ok(struct page *page, unsigned int order);
 
+#ifndef SINGLE_ZONE
 /*
  * results with 256, 32 in the lowmem_reserve sysctl:
  *	1G machine -> (16M dma, 800M-16M normal, 1G-800M high)
@@ -79,6 +80,7 @@ int sysctl_lowmem_reserve_ratio[MAX_NR_Z
 	 32
 #endif
 };
+#endif
 
 EXPORT_SYMBOL(totalram_pages);
 
@@ -878,8 +880,11 @@ int zone_watermark_ok(struct zone *z, in
 		min -= min / 2;
 	if (alloc_flags & ALLOC_HARDER)
 		min -= min / 4;
-
+#ifdef SINGLE_ZONE
+	if (free_pages <= min)
+#else
 	if (free_pages <= min + z->lowmem_reserve[classzone_idx])
+#endif
 		return 0;
 	for (o = 0; o < order; o++) {
 		/* At the next order, this order's pages become unavailable */
@@ -1424,10 +1429,12 @@ void show_free_areas(void)
 			zone->pages_scanned,
 			(zone->all_unreclaimable ? "yes" : "no")
 			);
+#ifndef SINGLE_ZONE
 		printk("lowmem_reserve[]:");
 		for (i = 0; i < MAX_NR_ZONES; i++)
 			printk(" %lu", zone->lowmem_reserve[i]);
 		printk("\n");
+#endif
 	}
 
 	for_each_zone(zone) {
@@ -2243,12 +2250,13 @@ static void calculate_totalreserve_pages
 			struct zone *zone = pgdat->node_zones + i;
 			unsigned long max = 0;
 
+#ifndef SINGLE_ZONE
 			/* Find valid and maximum lowmem_reserve in the zone */
 			for (j = i; j < MAX_NR_ZONES; j++) {
 				if (zone->lowmem_reserve[j] > max)
 					max = zone->lowmem_reserve[j];
 			}
-
+#endif
 			/* we treat pages_high as reserved pages. */
 			max += zone->pages_high;
 
@@ -2268,6 +2276,7 @@ static void calculate_totalreserve_pages
  */
 static void setup_per_zone_lowmem_reserve(void)
 {
+#ifndef SINGLE_ZONE
 	struct pglist_data *pgdat;
 	int j, idx;
 
@@ -2294,6 +2303,7 @@ static void setup_per_zone_lowmem_reserv
 
 	/* update totalreserve_pages */
 	calculate_totalreserve_pages();
+#endif
 }
 
 /*
@@ -2427,6 +2437,7 @@ int sysctl_min_unmapped_ratio_sysctl_han
 }
 #endif
 
+#ifndef SINGLE_ZONE
 /*
  * lowmem_reserve_ratio_sysctl_handler - just a wrapper around
  *	proc_dointvec() so that we can call setup_per_zone_lowmem_reserve()
@@ -2443,6 +2454,7 @@ int lowmem_reserve_ratio_sysctl_handler(
 	setup_per_zone_lowmem_reserve();
 	return 0;
 }
+#endif
 
 /*
  * percpu_pagelist_fraction - changes the pcp->high for each zone on each
Index: linux-2.6.17-mm6/kernel/sysctl.c
===================================================================
--- linux-2.6.17-mm6.orig/kernel/sysctl.c	2006-07-03 13:47:22.500857523 -0700
+++ linux-2.6.17-mm6/kernel/sysctl.c	2006-07-07 16:51:50.432016309 -0700
@@ -903,6 +903,7 @@ static ctl_table vm_table[] = {
 		.proc_handler	= &proc_dointvec,
 	 },
 #endif
+#ifndef SINGLE_ZONE
 	{
 		.ctl_name	= VM_LOWMEM_RESERVE_RATIO,
 		.procname	= "lowmem_reserve_ratio",
@@ -912,6 +913,7 @@ static ctl_table vm_table[] = {
 		.proc_handler	= &lowmem_reserve_ratio_sysctl_handler,
 		.strategy	= &sysctl_intvec,
 	},
+#endif
 	{
 		.ctl_name	= VM_DROP_PAGECACHE,
 		.procname	= "drop_caches",
Index: linux-2.6.17-mm6/include/linux/mmzone.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/mmzone.h	2006-07-07 16:50:18.787291855 -0700
+++ linux-2.6.17-mm6/include/linux/mmzone.h	2006-07-07 16:51:50.432992811 -0700
@@ -180,6 +180,7 @@ typedef enum {
 #else
 #define GFP_ZONEMASK		0x00
 #define ZONES_SHIFT		0
+#define SINGLE_ZONE		1
 #endif
 #endif
 #endif
@@ -188,6 +189,7 @@ struct zone {
 	/* Fields commonly accessed by the page allocator */
 	unsigned long		free_pages;
 	unsigned long		pages_min, pages_low, pages_high;
+#ifndef SINGLE_ZONE
 	/*
 	 * We don't know if the memory that we're going to allocate will be freeable
 	 * or/and it will be released eventually, so to avoid totally wasting several
@@ -197,6 +199,7 @@ struct zone {
 	 * sysctl_lowmem_reserve_ratio sysctl changes.
 	 */
 	unsigned long		lowmem_reserve[MAX_NR_ZONES];
+#endif
 
 #ifdef CONFIG_NUMA
 	/*
@@ -419,7 +422,11 @@ unsigned long __init node_memmap_size_by
 /*
  * zone_idx() returns 0 for the ZONE_DMA zone, 1 for the ZONE_NORMAL zone, etc.
  */
+#ifndef SINGLE_ZONE
 #define zone_idx(zone)		((zone) - (zone)->zone_pgdat->node_zones)
+#else
+#define zone_idx(zone)		ZONE_NORMAL
+#endif
 
 static inline int populated_zone(struct zone *zone)
 {
@@ -437,7 +444,11 @@ static inline int is_highmem_idx(zones_t
 
 static inline int is_normal_idx(zones_t idx)
 {
+#ifndef SINGLE_ZONE
 	return (idx == ZONE_NORMAL);
+#else
+	return 1;
+#endif
 }
 
 /**
@@ -457,7 +468,9 @@ static inline int is_highmem(struct zone
 
 static inline int is_normal(struct zone *zone)
 {
+#ifndef SINGLE_ZONE
 	return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL;
+#endif
 }
 
 static inline int is_dma32(struct zone *zone)
@@ -483,9 +496,11 @@ struct ctl_table;
 struct file;
 int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *, 
 					void __user *, size_t *, loff_t *);
+#ifndef SINGLE_ZONE
 extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
 int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *,
 					void __user *, size_t *, loff_t *);
+#endif
 int percpu_pagelist_fraction_sysctl_handler(struct ctl_table *, int, struct file *,
 					void __user *, size_t *, loff_t *);
 int sysctl_min_unmapped_ratio_sysctl_handler(struct ctl_table *, int,

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

* [RFC 8/8] Optimize mempolicies for a single zone
  2006-07-08  0:05 [RFC 0/8] Optional ZONE_DMA Christoph Lameter
                   ` (6 preceding siblings ...)
  2006-07-08  0:05 ` [RFC 7/8] Single zone optimizations Christoph Lameter
@ 2006-07-08  0:05 ` Christoph Lameter
  2006-07-08  0:17   ` Andi Kleen
  7 siblings, 1 reply; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  0:05 UTC (permalink / raw)
  To: linux-kernel
  Cc: Nick Piggin, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Martin Bligh, Christoph Lameter,
	KAMEZAWA Hiroyuki, Andi Kleen

Use SINGLE_ZONE to remove the highest zone determination

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

Index: linux-2.6.17-mm6/mm/mempolicy.c
===================================================================
--- linux-2.6.17-mm6.orig/mm/mempolicy.c	2006-07-07 16:50:18.790221361 -0700
+++ linux-2.6.17-mm6/mm/mempolicy.c	2006-07-07 16:53:46.057679926 -0700
@@ -103,9 +103,11 @@ static struct kmem_cache *sn_cache;
 
 #define PDprintk(fmt...)
 
+#ifndef SINGLE_ZONE
 /* Highest zone. An specific allocation for a zone below that is not
    policied. */
 int policy_zone = 0;
+#endif
 
 struct mempolicy default_policy = {
 	.refcnt = ATOMIC_INIT(1), /* never free it */
Index: linux-2.6.17-mm6/include/linux/mempolicy.h
===================================================================
--- linux-2.6.17-mm6.orig/include/linux/mempolicy.h	2006-07-03 13:47:21.727467854 -0700
+++ linux-2.6.17-mm6/include/linux/mempolicy.h	2006-07-07 16:53:46.057679926 -0700
@@ -162,12 +162,18 @@ extern struct zonelist *huge_zonelist(st
 		unsigned long addr);
 extern unsigned slab_node(struct mempolicy *policy);
 
+#ifndef SINGLE_ZONE
+#define policy_zone ZONE_NORMAL
+#else
 extern int policy_zone;
+#endif
 
 static inline void check_highest_zone(int k)
 {
+#ifndef SINGLE_ZONE
 	if (k > policy_zone)
 		policy_zone = k;
+#endif
 }
 
 int do_migrate_pages(struct mm_struct *mm,

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

* Re: [RFC 8/8] Optimize mempolicies for a single zone
  2006-07-08  0:05 ` [RFC 8/8] Optimize mempolicies for a single zone Christoph Lameter
@ 2006-07-08  0:17   ` Andi Kleen
  0 siblings, 0 replies; 20+ messages in thread
From: Andi Kleen @ 2006-07-08  0:17 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-kernel, Nick Piggin, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Martin Bligh, KAMEZAWA Hiroyuki


> +#ifndef SINGLE_ZONE
> +#define policy_zone ZONE_NORMAL
> +#else
>  extern int policy_zone;
> +#endif
> 
>  static inline void check_highest_zone(int k)
>  {
> +#ifndef SINGLE_ZONE
>  	if (k > policy_zone)
>  		policy_zone = k;
> +#endif

This looks ugly. What's wrong the simple variable?

-Andi

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

* Re: [RFC 7/8] Single zone optimizations
  2006-07-08  0:05 ` [RFC 7/8] Single zone optimizations Christoph Lameter
@ 2006-07-08  0:19   ` Andi Kleen
  0 siblings, 0 replies; 20+ messages in thread
From: Andi Kleen @ 2006-07-08  0:19 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-kernel, Martin Bligh, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Nick Piggin, KAMEZAWA Hiroyuki

On Saturday 08 July 2006 02:05, Christoph Lameter wrote:
> Single Zone Optimizations
> 
> If we only have a single zone then various macros can be optimized.
> 
> We do not need to protect higher zones etc etc.

Nearly all the stuff you remove is slow path and even __init
where neither performance nor code size matter much.
The ifdefs look ugly. 

I have my doubts they are worth it.

-Andi


> 

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

* Re: [RFC 5/8] x86_64 without ZONE_DMA
  2006-07-08  0:05 ` [RFC 5/8] x86_64 without ZONE_DMA Christoph Lameter
@ 2006-07-08  0:20   ` Andi Kleen
  2006-07-08  0:42     ` Christoph Lameter
  0 siblings, 1 reply; 20+ messages in thread
From: Andi Kleen @ 2006-07-08  0:20 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-kernel, Martin Bligh, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Nick Piggin, KAMEZAWA Hiroyuki

On Saturday 08 July 2006 02:05, Christoph Lameter wrote:
> x86_64: ZONE_DMA/ZONE_DMA32 optional
> 
> Allow the use to specify CONFIG_ZONE_DMA32 and CONFIG_ZONE_DMA (via
> CONFIG_GENERIC_ISA_DMA).

Why? 

I don't think the savings from this are enough to bother
the user with such an obscure config option.

-Andi


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

* Re: [RFC 4/8] page allocator: Optional ZONE_DMA
  2006-07-08  0:05 ` [RFC 4/8] page allocator: " Christoph Lameter
@ 2006-07-08  0:23   ` Andi Kleen
  2006-07-08  0:41     ` Christoph Lameter
  0 siblings, 1 reply; 20+ messages in thread
From: Andi Kleen @ 2006-07-08  0:23 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-kernel, Nick Piggin, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Martin Bligh, KAMEZAWA Hiroyuki

On Saturday 08 July 2006 02:05, Christoph Lameter wrote:
> Make ZONE_DMA optional in the page allocator

Hmm, we should rename you the "ifdef warrior"

> - ifdef all code for ZONE_DMA and related definition
> 
> - Without ZONE_DMA, ZONE_HIGHMEM and ZONE_DMA32 we fall back
>   to an empty GFP_ZONEMASK and a ZONES_SHIFT of zero (since there
>   is only one zone....).
> 
> - We need to fix the use of ZONE_DMA in the memory policy layer.
>   ZONE_DMA is used there as the first zone so use 0 instead.


Is the barely better code really worth all the ugliness from the ifdefs? I have doubts.

I think your idea of saving some cache lines by not having the unused
zones in the fallback lists etc. is a good one, but your current implementation
with its ifdef maze is extremly ugly. Surely this can be a done less
intrusively?

-Andi

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

* Re: [RFC 4/8] page allocator: Optional ZONE_DMA
  2006-07-08  0:23   ` Andi Kleen
@ 2006-07-08  0:41     ` Christoph Lameter
  0 siblings, 0 replies; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  0:41 UTC (permalink / raw)
  To: Andi Kleen
  Cc: linux-kernel, Nick Piggin, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Martin Bligh, KAMEZAWA Hiroyuki

On Sat, 8 Jul 2006, Andi Kleen wrote:

> I think your idea of saving some cache lines by not having the unused
> zones in the fallback lists etc. is a good one, but your current implementation
> with its ifdef maze is extremly ugly. Surely this can be a done less
> intrusively?

I'd be glad if someone would come up with such an idea.


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

* Re: [RFC 5/8] x86_64 without ZONE_DMA
  2006-07-08  0:20   ` Andi Kleen
@ 2006-07-08  0:42     ` Christoph Lameter
  2006-07-08  1:00       ` Andi Kleen
  0 siblings, 1 reply; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  0:42 UTC (permalink / raw)
  To: Andi Kleen
  Cc: linux-kernel, Martin Bligh, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Nick Piggin, KAMEZAWA Hiroyuki

On Sat, 8 Jul 2006, Andi Kleen wrote:

> I don't think the savings from this are enough to bother
> the user with such an obscure config option.

The savings are not only from the code paths. The VM itself is cleaner and 
the balancing issues are not that troublesome anymore.

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

* Re: [RFC 5/8] x86_64 without ZONE_DMA
  2006-07-08  0:42     ` Christoph Lameter
@ 2006-07-08  1:00       ` Andi Kleen
  2006-07-08  1:25         ` Christoph Lameter
  0 siblings, 1 reply; 20+ messages in thread
From: Andi Kleen @ 2006-07-08  1:00 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-kernel, Martin Bligh, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Nick Piggin, KAMEZAWA Hiroyuki

On Saturday 08 July 2006 02:42, Christoph Lameter wrote:
> On Sat, 8 Jul 2006, Andi Kleen wrote:
> 
> > I don't think the savings from this are enough to bother
> > the user with such an obscure config option.
> 
> The savings are not only from the code paths. The VM itself is cleaner and 
> the balancing issues are not that troublesome anymore.

Doesn't help - it has to be fixed anyways for NUMA and other architectures.

Also in my experience empty zones are not a significant problem for VM
balancing.

-Andi

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

* Re: [RFC 5/8] x86_64 without ZONE_DMA
  2006-07-08  1:00       ` Andi Kleen
@ 2006-07-08  1:25         ` Christoph Lameter
  0 siblings, 0 replies; 20+ messages in thread
From: Christoph Lameter @ 2006-07-08  1:25 UTC (permalink / raw)
  To: Andi Kleen
  Cc: linux-kernel, Martin Bligh, Christoph Hellwig, Marcelo Tosatti,
	Arjan van de Ven, Nick Piggin, KAMEZAWA Hiroyuki

On Sat, 8 Jul 2006, Andi Kleen wrote:

> > The savings are not only from the code paths. The VM itself is cleaner and 
> > the balancing issues are not that troublesome anymore.
> 
> Doesn't help - it has to be fixed anyways for NUMA and other architectures.

Some architectures like ours can run with a single zone since they have 
DMA that works anywhere. Same thing is true for my machines are home and 
at work.
 
> Also in my experience empty zones are not a significant problem for VM
> balancing.

The problem is that the zones are not even empty! We keep 16M in some 
weird ZONE_DMA that barely anyone one uses anymore and add slabs to it 
that are only used by some confused device drivers.

Also the empty zones are still a problem since they have to be scanned 
repeatedly (potentially on each allocation). They waste cachelines and 
result in loops where we could just have straight code.

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

* Re: [RFC 1/8] Add CONFIG_ZONE_DMA to all archesM
  2006-07-08  0:05 ` [RFC 1/8] Add CONFIG_ZONE_DMA to all archesM Christoph Lameter
@ 2006-07-10  0:52   ` KAMEZAWA Hiroyuki
  2006-07-10 15:56     ` Christoph Lameter
  0 siblings, 1 reply; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-07-10  0:52 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-kernel, mbligh, hch, marcelo, arjan, nickpiggin, clameter, ak

On Fri, 7 Jul 2006 17:05:06 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:
> As a result of this patch CONFIG_ZONE_DMA should be defined for every
> arch.
> 
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
> 
> Index: linux-2.6.17-mm6/mm/Kconfig
> ===================================================================
> --- linux-2.6.17-mm6.orig/mm/Kconfig	2006-07-03 13:47:22.616084772 -0700
> +++ linux-2.6.17-mm6/mm/Kconfig	2006-07-03 21:26:49.956038556 -0700
> @@ -134,6 +134,10 @@ config SPLIT_PTLOCK_CPUS
>  	default "4096" if PARISC && !PA20
>  	default "4"
>  
> +config ZONE_DMA
> +	def_bool y
> +	depends on GENERIC_ISA_DMA
> +

How about configuring this by

config ZONE_DMA
	def_bool y
	depends on GENERIC_ISA_DMA || ARCH_ZONE_DMA

and set ARCH_ZONE_DMA for each arch ?


-Kame


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

* Re: [RFC 1/8] Add CONFIG_ZONE_DMA to all archesM
  2006-07-10  0:52   ` KAMEZAWA Hiroyuki
@ 2006-07-10 15:56     ` Christoph Lameter
  2006-07-11  7:11       ` KAMEZAWA Hiroyuki
  0 siblings, 1 reply; 20+ messages in thread
From: Christoph Lameter @ 2006-07-10 15:56 UTC (permalink / raw)
  To: KAMEZAWA Hiroyuki
  Cc: linux-kernel, mbligh, hch, marcelo, arjan, nickpiggin, ak

On Mon, 10 Jul 2006, KAMEZAWA Hiroyuki wrote:

> 
> How about configuring this by
> 
> config ZONE_DMA
> 	def_bool y
> 	depends on GENERIC_ISA_DMA || ARCH_ZONE_DMA
> 
> and set ARCH_ZONE_DMA for each arch ?

Yes we do something like that in a later patch. What would be the 
advantage of having CONFIG_ARCH_ZONE_DMA instead of CONFIG_ZONE_DMA?



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

* Re: [RFC 1/8] Add CONFIG_ZONE_DMA to all archesM
  2006-07-10 15:56     ` Christoph Lameter
@ 2006-07-11  7:11       ` KAMEZAWA Hiroyuki
  0 siblings, 0 replies; 20+ messages in thread
From: KAMEZAWA Hiroyuki @ 2006-07-11  7:11 UTC (permalink / raw)
  To: Christoph Lameter
  Cc: linux-kernel, mbligh, hch, marcelo, arjan, nickpiggin, ak

On Mon, 10 Jul 2006 08:56:50 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:

> On Mon, 10 Jul 2006, KAMEZAWA Hiroyuki wrote:
> 
> > 
> > How about configuring this by
> > 
> > config ZONE_DMA
> > 	def_bool y
> > 	depends on GENERIC_ISA_DMA || ARCH_ZONE_DMA
> > 
> > and set ARCH_ZONE_DMA for each arch ?
> 
> Yes we do something like that in a later patch. What would be the 
> advantage of having CONFIG_ARCH_ZONE_DMA instead of CONFIG_ZONE_DMA?
> 
I think it's a bit complicated that both (generic)mm/Kconfig and arch/???/Kconfg
has the same config option. I think there are 2 ways..

1. remove CONFIG_ZONE_DMA from mm/Kconfig and move all to under arch/
2. define ARCH_ZONE_DMA under /arch and unite them in mm/Kconfig by
   CONFIG_ZONE_DMA


-Kame


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

end of thread, other threads:[~2006-07-11  7:10 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-07-08  0:05 [RFC 0/8] Optional ZONE_DMA Christoph Lameter
2006-07-08  0:05 ` [RFC 1/8] Add CONFIG_ZONE_DMA to all archesM Christoph Lameter
2006-07-10  0:52   ` KAMEZAWA Hiroyuki
2006-07-10 15:56     ` Christoph Lameter
2006-07-11  7:11       ` KAMEZAWA Hiroyuki
2006-07-08  0:05 ` [RFC 2/8] slab allocator: Make DMA support configurable Christoph Lameter
2006-07-08  0:05 ` [RFC 3/8] eventcounters: Optional ZONE_DMA Christoph Lameter
2006-07-08  0:05 ` [RFC 4/8] page allocator: " Christoph Lameter
2006-07-08  0:23   ` Andi Kleen
2006-07-08  0:41     ` Christoph Lameter
2006-07-08  0:05 ` [RFC 5/8] x86_64 without ZONE_DMA Christoph Lameter
2006-07-08  0:20   ` Andi Kleen
2006-07-08  0:42     ` Christoph Lameter
2006-07-08  1:00       ` Andi Kleen
2006-07-08  1:25         ` Christoph Lameter
2006-07-08  0:05 ` [RFC 6/8] i386 " Christoph Lameter
2006-07-08  0:05 ` [RFC 7/8] Single zone optimizations Christoph Lameter
2006-07-08  0:19   ` Andi Kleen
2006-07-08  0:05 ` [RFC 8/8] Optimize mempolicies for a single zone Christoph Lameter
2006-07-08  0:17   ` Andi Kleen

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.