Skip to contentSkip to conversation

slab.c ifdef reduction breaks build

PATCH In review Jeff Dike 3 participants 6 messages Jan 29, 2007 – Jan 30, 2007 Memory management

lore
Share & tools
lore

Jeff Dike

author
#0 lore raw

PATCH 1/1 slab.c ifdef reduction breaks build

optional-zone_dma-in-the-vm-no-gfp_dma-check-in-the-slab-if- no-config_zone_dma-is-set-reduce-config_zone_dma-ifdefs converts some ifdefs into ifs.

One of them causes cs_dmacachep to be referenced, when that field doesn't exist, because it's ifdefed on CONFIG_ZONE_DMA.

I'd suggest reverting that chunk.

--

 mm/slab.c |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
mm/slab.c +3 -2
Index: linux-2.6.18-mm/mm/slab.c
===================================================================
@@ -1492,14 +1492,15 @@ void __init kmem_cache_init(void)
 					ARCH_KMALLOC_FLAGS|SLAB_PANIC,
 					NULL, NULL);
 		}
-		if (CONFIG_ZONE_DMA_FLAG)
-			sizes->cs_dmacachep = kmem_cache_create(
+#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++;
 	}
Signature · 1 line
Work email - jdike at linux dot intel dot com
#1 lore raw

mm/slab.c void __init kmem_cache_init(void) · line 1496

Quoted 2 lines · Jeff Dike
mm/slab.c +2 -0
+#if CONFIG_ZONE_DMA_FLAG
+		sizes->cs_dmacachep = kmem_cache_create(

This would need to be

#idef CONFIG_ZONE_DMA

There have been some recent changes though so I am not sure what your codebase is.

#2 lore raw

I also hit the same issue. Here is the patch:

Fix slab build failure if !CONFIG_ZONE_DMA

I also needed this to get 2.6.20-rc6-mm2 to build. Fixes the fix by the complainer about the fixes. #ifdef cannot be avoided since cs_dmacachep is no longer defined.

mm/slab.c +2 -0
Index: linux-2.6.20-rc6-mm2/mm/slab.c
===================================================================
@@ -1503,6 +1503,7 @@ void __init kmem_cache_init(void)
 					ARCH_KMALLOC_FLAGS|SLAB_PANIC,
 					NULL, NULL);
 		}
+#ifdef CONFIG_ZONE_DMA
 		if (CONFIG_ZONE_DMA_FLAG)
 			sizes->cs_dmacachep = kmem_cache_create(
 					names->name_dma,
@@ -1511,6 +1512,7 @@ void __init kmem_cache_init(void)
 					ARCH_KMALLOC_FLAGS|SLAB_CACHE_DMA|
 						SLAB_PANIC,
 					NULL, NULL);
+#endif
 		sizes++;
 		names++;
 	}
#3 lore raw

mm/slab.c void __init kmem_cache_init(void) · line 1507

Quoted 2 lines · On Mon, 29 Jan 2007 12:41:33 -0800 (PST) Christoph Lameter <[email protected]>…
mm/slab.c +1 -0
+#ifdef CONFIG_ZONE_DMA
 		if (CONFIG_ZONE_DMA_FLAG)

We don't need the `if (CONFIG_ZONE_DMA_FLAG)' any more, do we?

#4 lore raw
Quoted 7 lines · Andrew Morton

mm/slab.c void __init kmem_cache_init(void) · line 1507

Quoted 2 lines · On Mon, 29 Jan 2007 12:41:33 -0800 (PST) Christoph Lameter <[email protected]>…
mm/slab.c +1 -0
+#ifdef CONFIG_ZONE_DMA
 		if (CONFIG_ZONE_DMA_FLAG)

We don't need the `if (CONFIG_ZONE_DMA_FLAG)' any more, do we?

Correct.

#5 lore raw
Quoted 5 lines · Christoph Lameter
Quoted 3 lines · Andrew Morton

On Mon, 29 Jan 2007 12:41:33 -0800 (PST)
Christoph Lameter <[email protected]> wrote:

Quoted 7 lines
Quoted 4 lines

Review

Quoted 2 lines
(quoted diff) +1 -0
+#ifdef CONFIG_ZONE_DMA
 		if (CONFIG_ZONE_DMA_FLAG)

We don't need the `if (CONFIG_ZONE_DMA_FLAG)' any more, do we?

Correct.

Here is the modified patch:

Fix slab build failure if !CONFIG_ZONE_DMA

I also needed this to get 2.6.20-rc6-mm2 to build. Fixes the fix of the complainer about the fixes.

mm/slab.c +3 -2
Index: linux-2.6.20-rc6-mm2/mm/slab.c
===================================================================
@@ -1504,14 +1504,15 @@ void __init kmem_cache_init(void)
 					ARCH_KMALLOC_FLAGS|SLAB_PANIC,
 					NULL, NULL);
 		}
-		if (CONFIG_ZONE_DMA_FLAG)
-			sizes->cs_dmacachep = kmem_cache_create(
+#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++;
 	}