aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
Diffstat (limited to 'mm')
-rw-r--r--mm/Kconfig6
-rw-r--r--mm/page_alloc.c4
-rw-r--r--mm/slab.c20
-rw-r--r--mm/vmstat.c8
4 files changed, 30 insertions, 8 deletions
diff --git a/mm/Kconfig b/mm/Kconfig
index 50f7cfc15b78..79360cf519bf 100644
--- a/mm/Kconfig
+++ b/mm/Kconfig
@@ -161,3 +161,9 @@ config RESOURCES_64BIT
161 default 64BIT 161 default 64BIT
162 help 162 help
163 This option allows memory and IO resources to be 64 bit. 163 This option allows memory and IO resources to be 64 bit.
164
165config ZONE_DMA_FLAG
166 int
167 default "0" if !ZONE_DMA
168 default "1"
169
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 6cff13840c6d..d461b23a27a1 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -73,7 +73,9 @@ static void __free_pages_ok(struct page *page, unsigned int order);
73 * don't need any ZONE_NORMAL reservation 73 * don't need any ZONE_NORMAL reservation
74 */ 74 */
75int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = { 75int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
76#ifdef CONFIG_ZONE_DMA
76 256, 77 256,
78#endif
77#ifdef CONFIG_ZONE_DMA32 79#ifdef CONFIG_ZONE_DMA32
78 256, 80 256,
79#endif 81#endif
@@ -85,7 +87,9 @@ int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
85EXPORT_SYMBOL(totalram_pages); 87EXPORT_SYMBOL(totalram_pages);
86 88
87static char * const zone_names[MAX_NR_ZONES] = { 89static char * const zone_names[MAX_NR_ZONES] = {
90#ifdef CONFIG_ZONE_DMA
88 "DMA", 91 "DMA",
92#endif
89#ifdef CONFIG_ZONE_DMA32 93#ifdef CONFIG_ZONE_DMA32
90 "DMA32", 94 "DMA32",
91#endif 95#endif
diff --git a/mm/slab.c b/mm/slab.c
index caa8f87e04eb..348396d691a1 100644
--- a/mm/slab.c
+++ b/mm/slab.c
@@ -793,8 +793,10 @@ static inline struct kmem_cache *__find_general_cachep(size_t size,
793 * has cs_{dma,}cachep==NULL. Thus no special case 793 * has cs_{dma,}cachep==NULL. Thus no special case
794 * for large kmalloc calls required. 794 * for large kmalloc calls required.
795 */ 795 */
796#ifdef CONFIG_ZONE_DMA
796 if (unlikely(gfpflags & GFP_DMA)) 797 if (unlikely(gfpflags & GFP_DMA))
797 return csizep->cs_dmacachep; 798 return csizep->cs_dmacachep;
799#endif
798 return csizep->cs_cachep; 800 return csizep->cs_cachep;
799} 801}
800 802
@@ -1493,13 +1495,15 @@ void __init kmem_cache_init(void)
1493 ARCH_KMALLOC_FLAGS|SLAB_PANIC, 1495 ARCH_KMALLOC_FLAGS|SLAB_PANIC,
1494 NULL, NULL); 1496 NULL, NULL);
1495 } 1497 }
1496 1498#ifdef CONFIG_ZONE_DMA
1497 sizes->cs_dmacachep = kmem_cache_create(names->name_dma, 1499 sizes->cs_dmacachep = kmem_cache_create(
1500 names->name_dma,
1498 sizes->cs_size, 1501 sizes->cs_size,
1499 ARCH_KMALLOC_MINALIGN, 1502 ARCH_KMALLOC_MINALIGN,
1500 ARCH_KMALLOC_FLAGS|SLAB_CACHE_DMA| 1503 ARCH_KMALLOC_FLAGS|SLAB_CACHE_DMA|
1501 SLAB_PANIC, 1504 SLAB_PANIC,
1502 NULL, NULL); 1505 NULL, NULL);
1506#endif
1503 sizes++; 1507 sizes++;
1504 names++; 1508 names++;
1505 } 1509 }
@@ -2321,7 +2325,7 @@ kmem_cache_create (const char *name, size_t size, size_t align,
2321 cachep->slab_size = slab_size; 2325 cachep->slab_size = slab_size;
2322 cachep->flags = flags; 2326 cachep->flags = flags;
2323 cachep->gfpflags = 0; 2327 cachep->gfpflags = 0;
2324 if (flags & SLAB_CACHE_DMA) 2328 if (CONFIG_ZONE_DMA_FLAG && (flags & SLAB_CACHE_DMA))
2325 cachep->gfpflags |= GFP_DMA; 2329 cachep->gfpflags |= GFP_DMA;
2326 cachep->buffer_size = size; 2330 cachep->buffer_size = size;
2327 cachep->reciprocal_buffer_size = reciprocal_value(size); 2331 cachep->reciprocal_buffer_size = reciprocal_value(size);
@@ -2643,10 +2647,12 @@ static void cache_init_objs(struct kmem_cache *cachep,
2643 2647
2644static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags) 2648static void kmem_flagcheck(struct kmem_cache *cachep, gfp_t flags)
2645{ 2649{
2646 if (flags & GFP_DMA) 2650 if (CONFIG_ZONE_DMA_FLAG) {
2647 BUG_ON(!(cachep->gfpflags & GFP_DMA)); 2651 if (flags & GFP_DMA)
2648 else 2652 BUG_ON(!(cachep->gfpflags & GFP_DMA));
2649 BUG_ON(cachep->gfpflags & GFP_DMA); 2653 else
2654 BUG_ON(cachep->gfpflags & GFP_DMA);
2655 }
2650} 2656}
2651 2657
2652static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp, 2658static void *slab_get_obj(struct kmem_cache *cachep, struct slab *slabp,
diff --git a/mm/vmstat.c b/mm/vmstat.c
index 5ffa8c27ead8..6c488d6ac425 100644
--- a/mm/vmstat.c
+++ b/mm/vmstat.c
@@ -408,6 +408,12 @@ const struct seq_operations fragmentation_op = {
408 .show = frag_show, 408 .show = frag_show,
409}; 409};
410 410
411#ifdef CONFIG_ZONE_DMA
412#define TEXT_FOR_DMA(xx) xx "_dma",
413#else
414#define TEXT_FOR_DMA(xx)
415#endif
416
411#ifdef CONFIG_ZONE_DMA32 417#ifdef CONFIG_ZONE_DMA32
412#define TEXT_FOR_DMA32(xx) xx "_dma32", 418#define TEXT_FOR_DMA32(xx) xx "_dma32",
413#else 419#else
@@ -420,7 +426,7 @@ const struct seq_operations fragmentation_op = {
420#define TEXT_FOR_HIGHMEM(xx) 426#define TEXT_FOR_HIGHMEM(xx)
421#endif 427#endif
422 428
423#define TEXTS_FOR_ZONES(xx) xx "_dma", TEXT_FOR_DMA32(xx) xx "_normal", \ 429#define TEXTS_FOR_ZONES(xx) TEXT_FOR_DMA(xx) TEXT_FOR_DMA32(xx) xx "_normal", \
424 TEXT_FOR_HIGHMEM(xx) 430 TEXT_FOR_HIGHMEM(xx)
425 431
426static const char * const vmstat_text[] = { 432static const char * const vmstat_text[] = {