* Reduce CONFIG_ZONE_DMA ifdefs
@ 2006-10-17 18:25 Christoph Lameter
2006-10-18 0:02 ` Andrew Morton
0 siblings, 1 reply; 4+ messages in thread
From: Christoph Lameter @ 2006-10-17 18:25 UTC (permalink / raw)
To: akpm; +Cc: linux-mm
Add a DMA_ZONE constant that can be used to avoid #ifdef DMAs. I hope this
will make it acceptable to remove ZONE_DMA dependent code such as the
bouncing logic and also allow us to deal with the GFP_DMA issues in the
SCSI layer.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.19-rc1-mm1/include/linux/mmzone.h
===================================================================
--- linux-2.6.19-rc1-mm1.orig/include/linux/mmzone.h 2006-10-17 13:08:22.000000000 -0500
+++ linux-2.6.19-rc1-mm1/include/linux/mmzone.h 2006-10-17 13:08:51.018160800 -0500
@@ -149,6 +149,12 @@ enum zone_type {
* match the requested limits. See gfp_zone() in include/linux/gfp.h
*/
+#ifdef CONFIG_ZONE_DMA
+#define DMA_ZONE 1
+#else
+#define DMA_ZONE 0
+#endif
+
/*
* Count the active zones. Note that the use of defined(X) outside
* #if and family is not necessarily defined so ensure we cannot use
Index: linux-2.6.19-rc1-mm1/mm/slab.c
===================================================================
--- linux-2.6.19-rc1-mm1.orig/mm/slab.c 2006-10-17 13:03:49.472950935 -0500
+++ linux-2.6.19-rc1-mm1/mm/slab.c 2006-10-17 13:08:08.215683664 -0500
@@ -1458,14 +1458,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,
+ if (DMA_ZONE)
+ 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++;
}
@@ -2298,10 +2298,8 @@ 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)
+ if (DMA_ZONE && (flags & SLAB_CACHE_DMA))
cachep->gfpflags |= GFP_DMA;
-#endif
cachep->buffer_size = size;
if (flags & CFLGS_OFF_SLAB) {
@@ -2624,12 +2622,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
+ if (DMA_ZONE) {
+ if (flags & SLAB_DMA)
+ BUG_ON(!(cachep->gfpflags & GFP_DMA));
+ else
+ BUG_ON(cachep->gfpflags & GFP_DMA);
+ }
}
static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp,
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Reduce CONFIG_ZONE_DMA ifdefs
2006-10-17 18:25 Reduce CONFIG_ZONE_DMA ifdefs Christoph Lameter
@ 2006-10-18 0:02 ` Andrew Morton
2006-10-18 0:29 ` Christoph Lameter
2006-10-23 23:06 ` Christoph Lameter
0 siblings, 2 replies; 4+ messages in thread
From: Andrew Morton @ 2006-10-18 0:02 UTC (permalink / raw)
To: Christoph Lameter; +Cc: linux-mm
On Tue, 17 Oct 2006 11:25:07 -0700 (PDT)
Christoph Lameter <clameter@sgi.com> wrote:
> Add a DMA_ZONE constant that can be used to avoid #ifdef DMAs. I hope this
> will make it acceptable to remove ZONE_DMA dependent code such as the
> bouncing logic and also allow us to deal with the GFP_DMA issues in the
> SCSI layer.
>
> Signed-off-by: Christoph Lameter <clameter@sgi.com>
>
> Index: linux-2.6.19-rc1-mm1/include/linux/mmzone.h
> ===================================================================
> --- linux-2.6.19-rc1-mm1.orig/include/linux/mmzone.h 2006-10-17 13:08:22.000000000 -0500
> +++ linux-2.6.19-rc1-mm1/include/linux/mmzone.h 2006-10-17 13:08:51.018160800 -0500
> @@ -149,6 +149,12 @@ enum zone_type {
> * match the requested limits. See gfp_zone() in include/linux/gfp.h
> */
>
> +#ifdef CONFIG_ZONE_DMA
> +#define DMA_ZONE 1
> +#else
> +#define DMA_ZONE 0
> +#endif
This can be done in the config system. See CONFIG_BASE_SMALL for an
example.
That would give the thing a nice name, too - say, CONFIG_HAVE_ZONE_DMA. It
makes it obvious what's going on.
If that doesn't work out, a better name would be HAVE_ZONE_DMA or
something. "DMA_ZONE" sounds like the number of the dma zone.
> -#ifdef CONFIG_ZONE_DMA
> -#ifdef CONFIG_ZONE_DMA
> -#ifdef CONFIG_ZONE_DMA
Only three. Drat.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: Reduce CONFIG_ZONE_DMA ifdefs
2006-10-18 0:02 ` Andrew Morton
@ 2006-10-18 0:29 ` Christoph Lameter
2006-10-23 23:06 ` Christoph Lameter
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2006-10-18 0:29 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm
On Tue, 17 Oct 2006, Andrew Morton wrote:
> That would give the thing a nice name, too - say, CONFIG_HAVE_ZONE_DMA. It
> makes it obvious what's going on.
Ok.
> > -#ifdef CONFIG_ZONE_DMA
> > -#ifdef CONFIG_ZONE_DMA
> > -#ifdef CONFIG_ZONE_DMA
>
> Only three. Drat.
The problem is that some of the definitions like ZONE_DMA become invalid
if CONFIG_ZONE_DMA is off and I think we need to keep that to make sure
code does not refer to invalid zones. Around those areas the #ifdef cannot
be dropped. The slab does not use ZONE_DMA directly. It only needs to deal
with GFP_DMA. For that it works nicely.
I hope such a scheme would also allow the switching off of the bounce
buffer logic and various other GFP_DMA related code all over the kernel.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Reduce CONFIG_ZONE_DMA ifdefs
2006-10-18 0:02 ` Andrew Morton
2006-10-18 0:29 ` Christoph Lameter
@ 2006-10-23 23:06 ` Christoph Lameter
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Lameter @ 2006-10-23 23:06 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-mm
V1->V2 use CONFIG_ZONE_DMA_FLAG that was defined in mm/Kconfig.
Reduce #ifdef CONFIG_ZONE_DMA
This reduces the #ifdefs in the slab allocator by adding a new
CONFIG_ZONE_DMA_FLAG in mm/Kconfig. The definitions for the
page allocator are already minimal and orthogonal to
CONFIG_ZONE_DMA32 and CONFIG_HIGHMEM.
Signed-off-by: Christoph Lameter <clameter@sgi.com>
Index: linux-2.6.19-rc2-mm2/mm/slab.c
===================================================================
--- linux-2.6.19-rc2-mm2.orig/mm/slab.c 2006-10-23 17:13:10.372360786 -0500
+++ linux-2.6.19-rc2-mm2/mm/slab.c 2006-10-23 17:28:49.336065747 -0500
@@ -1458,14 +1458,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,
+ if (CONFIG_ZONE_DMA_FLAG)
+ 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++;
}
@@ -2297,10 +2297,8 @@ 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)
+ if (CONFIG_ZONE_DMA_FLAG && (flags & SLAB_CACHE_DMA))
cachep->gfpflags |= GFP_DMA;
-#endif
cachep->buffer_size = size;
if (flags & CFLGS_OFF_SLAB) {
@@ -2623,12 +2621,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
+ if (CONFIG_ZONE_DMA_FLAG) {
+ if (flags & SLAB_DMA)
+ BUG_ON(!(cachep->gfpflags & GFP_DMA));
+ else
+ BUG_ON(cachep->gfpflags & GFP_DMA);
+ }
}
static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp,
Index: linux-2.6.19-rc2-mm2/mm/Kconfig
===================================================================
--- linux-2.6.19-rc2-mm2.orig/mm/Kconfig 2006-10-23 17:13:10.382127229 -0500
+++ linux-2.6.19-rc2-mm2/mm/Kconfig 2006-10-23 17:52:25.537437185 -0500
@@ -242,3 +242,9 @@ config READAHEAD_SMOOTH_AGING
- have the danger of readahead thrashing(i.e. memory tight)
This feature is only available on non-NUMA systems.
+
+config ZONE_DMA_FLAG
+ int
+ default "0" if !ZONE_DMA
+ default "1"
+
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2006-10-23 23:06 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-10-17 18:25 Reduce CONFIG_ZONE_DMA ifdefs Christoph Lameter
2006-10-18 0:02 ` Andrew Morton
2006-10-18 0:29 ` Christoph Lameter
2006-10-23 23:06 ` Christoph Lameter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox