Commit 23a43a63 authored by Andy Whitcroft's avatar Andy Whitcroft Committed by Linus Torvalds

[PATCH] is_highmem() and WANT_PAGE_VIRTUAL

Add is_highmem_idx() and is_normal_idx() to determine whether
a zone index is a highmem or normal zone.  Use this for
memmap_init_zone().
Signed-off-by: default avatarAndy Whitcroft <apw@shadowen.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 31fd9d3f
...@@ -345,6 +345,15 @@ static inline struct zone *next_zone(struct zone *zone) ...@@ -345,6 +345,15 @@ static inline struct zone *next_zone(struct zone *zone)
#define for_each_zone(zone) \ #define for_each_zone(zone) \
for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone)) for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone))
static inline int is_highmem_idx(int idx)
{
return (idx == ZONE_HIGHMEM);
}
static inline int is_normal_idx(int idx)
{
return (idx == ZONE_NORMAL);
}
/** /**
* is_highmem - helper function to quickly check if a struct zone is a * is_highmem - helper function to quickly check if a struct zone is a
* highmem zone or not. This is an attempt to keep references * highmem zone or not. This is an attempt to keep references
...@@ -353,12 +362,12 @@ static inline struct zone *next_zone(struct zone *zone) ...@@ -353,12 +362,12 @@ static inline struct zone *next_zone(struct zone *zone)
*/ */
static inline int is_highmem(struct zone *zone) static inline int is_highmem(struct zone *zone)
{ {
return (zone - zone->zone_pgdat->node_zones == ZONE_HIGHMEM); return (is_highmem_idx(zone - zone->zone_pgdat->node_zones));
} }
static inline int is_normal(struct zone *zone) static inline int is_normal(struct zone *zone)
{ {
return (zone - zone->zone_pgdat->node_zones == ZONE_NORMAL); return (is_normal_idx(zone - zone->zone_pgdat->node_zones));
} }
/* These two functions are used to setup the per zone pages min values */ /* These two functions are used to setup the per zone pages min values */
......
...@@ -1402,7 +1402,7 @@ void __init memmap_init_zone(struct page *start, unsigned long size, int nid, ...@@ -1402,7 +1402,7 @@ void __init memmap_init_zone(struct page *start, unsigned long size, int nid,
INIT_LIST_HEAD(&page->lru); INIT_LIST_HEAD(&page->lru);
#ifdef WANT_PAGE_VIRTUAL #ifdef WANT_PAGE_VIRTUAL
/* The shift won't overflow because ZONE_NORMAL is below 4G. */ /* The shift won't overflow because ZONE_NORMAL is below 4G. */
if (!is_highmem(zone)) if (!is_highmem_idx(zone))
set_page_address(page, __va(start_pfn << PAGE_SHIFT)); set_page_address(page, __va(start_pfn << PAGE_SHIFT));
#endif #endif
start_pfn++; start_pfn++;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment