提交 fb0e7942 编写于 作者: C Christoph Lameter 提交者: Linus Torvalds

[PATCH] reduce MAX_NR_ZONES: make ZONE_DMA32 optional

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: NChristoph Lameter <clameter@sgi.com>
Signed-off-by: NAndrew Morton <akpm@osdl.org>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 2f1b6248
...@@ -66,15 +66,6 @@ config IA64_UNCACHED_ALLOCATOR ...@@ -66,15 +66,6 @@ config IA64_UNCACHED_ALLOCATOR
bool bool
select GENERIC_ALLOCATOR select GENERIC_ALLOCATOR
config DMA_IS_DMA32
bool
default y
config DMA_IS_NORMAL
bool
depends on IA64_SGI_SN2
default y
config AUDIT_ARCH config AUDIT_ARCH
bool bool
default y default y
......
...@@ -24,6 +24,10 @@ config X86 ...@@ -24,6 +24,10 @@ config X86
bool bool
default y default y
config ZONE_DMA32
bool
default y
config LOCKDEP_SUPPORT config LOCKDEP_SUPPORT
bool bool
default y default y
......
...@@ -13,7 +13,7 @@ struct vm_area_struct; ...@@ -13,7 +13,7 @@ struct vm_area_struct;
/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */ /* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
#define __GFP_DMA ((__force gfp_t)0x01u) #define __GFP_DMA ((__force gfp_t)0x01u)
#define __GFP_HIGHMEM ((__force gfp_t)0x02u) #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 */ #define __GFP_DMA32 ((__force gfp_t)0x01) /* ZONE_DMA is ZONE_DMA32 */
#elif BITS_PER_LONG < 64 #elif BITS_PER_LONG < 64
#define __GFP_DMA32 ((__force gfp_t)0x00) /* ZONE_NORMAL is ZONE_DMA32 */ #define __GFP_DMA32 ((__force gfp_t)0x00) /* ZONE_NORMAL is ZONE_DMA32 */
......
...@@ -109,12 +109,14 @@ enum zone_type { ...@@ -109,12 +109,14 @@ enum zone_type {
* <16M. * <16M.
*/ */
ZONE_DMA, ZONE_DMA,
#ifdef CONFIG_ZONE_DMA32
/* /*
* x86_64 needs two ZONE_DMAs because it supports devices that are * 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 * only able to do DMA to the lower 16M but also 32 bit devices that
* can only do DMA areas below 4G. * can only do DMA areas below 4G.
*/ */
ZONE_DMA32, ZONE_DMA32,
#endif
/* /*
* Normal addressable memory is in ZONE_NORMAL. DMA operations can be * Normal addressable memory is in ZONE_NORMAL. DMA operations can be
* performed on pages in ZONE_NORMAL if the DMA devices support * performed on pages in ZONE_NORMAL if the DMA devices support
...@@ -161,10 +163,14 @@ enum zone_type { ...@@ -161,10 +163,14 @@ enum zone_type {
* *
* NOTE! Make sure this matches the zones in <linux/gfp.h> * 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 { struct zone {
/* Fields commonly accessed by the page allocator */ /* Fields commonly accessed by the page allocator */
unsigned long free_pages; unsigned long free_pages;
...@@ -429,7 +435,11 @@ static inline int is_normal(struct zone *zone) ...@@ -429,7 +435,11 @@ static inline int is_normal(struct zone *zone)
static inline int is_dma32(struct zone *zone) static inline int is_dma32(struct zone *zone)
{ {
#ifdef CONFIG_ZONE_DMA32
return zone == zone->zone_pgdat->node_zones + ZONE_DMA32; return zone == zone->zone_pgdat->node_zones + ZONE_DMA32;
#else
return 0;
#endif
} }
static inline int is_dma(struct zone *zone) static inline int is_dma(struct zone *zone)
......
...@@ -124,12 +124,10 @@ static inline unsigned long node_page_state(int node, ...@@ -124,12 +124,10 @@ static inline unsigned long node_page_state(int node,
struct zone *zones = NODE_DATA(node)->node_zones; struct zone *zones = NODE_DATA(node)->node_zones;
return return
#ifndef CONFIG_DMA_IS_NORMAL #ifdef CONFIG_ZONE_DMA32
#if !defined(CONFIG_DMA_IS_DMA32) && BITS_PER_LONG >= 64
zone_page_state(&zones[ZONE_DMA32], item) + zone_page_state(&zones[ZONE_DMA32], item) +
#endif #endif
zone_page_state(&zones[ZONE_NORMAL], item) + zone_page_state(&zones[ZONE_NORMAL], item) +
#endif
#ifdef CONFIG_HIGHMEM #ifdef CONFIG_HIGHMEM
zone_page_state(&zones[ZONE_HIGHMEM], item) + zone_page_state(&zones[ZONE_HIGHMEM], item) +
#endif #endif
......
...@@ -70,7 +70,9 @@ static void __free_pages_ok(struct page *page, unsigned int order); ...@@ -70,7 +70,9 @@ static void __free_pages_ok(struct page *page, unsigned int order);
*/ */
int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = { int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1] = {
256, 256,
#ifdef CONFIG_ZONE_DMA32
256, 256,
#endif
32 32
}; };
...@@ -85,7 +87,9 @@ EXPORT_SYMBOL(zone_table); ...@@ -85,7 +87,9 @@ EXPORT_SYMBOL(zone_table);
static char *zone_names[MAX_NR_ZONES] = { static char *zone_names[MAX_NR_ZONES] = {
"DMA", "DMA",
#ifdef CONFIG_ZONE_DMA32
"DMA32", "DMA32",
#endif
"Normal", "Normal",
"HighMem" "HighMem"
}; };
...@@ -1373,8 +1377,10 @@ static inline int highest_zone(int zone_bits) ...@@ -1373,8 +1377,10 @@ static inline int highest_zone(int zone_bits)
int res = ZONE_NORMAL; int res = ZONE_NORMAL;
if (zone_bits & (__force int)__GFP_HIGHMEM) if (zone_bits & (__force int)__GFP_HIGHMEM)
res = ZONE_HIGHMEM; res = ZONE_HIGHMEM;
#ifdef CONFIG_ZONE_DMA32
if (zone_bits & (__force int)__GFP_DMA32) if (zone_bits & (__force int)__GFP_DMA32)
res = ZONE_DMA32; res = ZONE_DMA32;
#endif
if (zone_bits & (__force int)__GFP_DMA) if (zone_bits & (__force int)__GFP_DMA)
res = ZONE_DMA; res = ZONE_DMA;
return res; return res;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册