ia64/xen-unstable

changeset 9155:20c1a71383a9

[IA64] Remove mmzone.h and warning:"MAX_ORDER" redefined

This patch removed xen/include/asm-ia64/linux/mmzohe.h which
is not used now, and removed warning "MAX_ORDER" redefined
from xen/common/page_alloc.c.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
author awilliam@xenbuild.aw
date Tue Mar 07 17:12:39 2006 -0700 (2006-03-07)
parents 294e032f14af
children 9215a9a1af9e
files xen/include/asm-ia64/linux-null/linux/mmzone.h xen/include/asm-ia64/linux-xen/linux/gfp.h xen/include/asm-ia64/linux/README.origin xen/include/asm-ia64/linux/mmzone.h
line diff
     2.1 --- a/xen/include/asm-ia64/linux-xen/linux/gfp.h	Tue Mar 07 17:08:20 2006 -0700
     2.2 +++ b/xen/include/asm-ia64/linux-xen/linux/gfp.h	Tue Mar 07 17:12:39 2006 -0700
     2.3 @@ -3,6 +3,7 @@
     2.4  
     2.5  #ifdef XEN
     2.6  #include <asm/bitops.h>
     2.7 +#include <linux/topology.h>
     2.8  #endif
     2.9  #include <linux/mmzone.h>
    2.10  #include <linux/stddef.h>
    2.11 @@ -85,6 +86,7 @@ struct vm_area_struct;
    2.12  static inline void arch_free_page(struct page *page, int order) { }
    2.13  #endif
    2.14  
    2.15 +#ifndef XEN
    2.16  extern struct page *
    2.17  FASTCALL(__alloc_pages(unsigned int, unsigned int, struct zonelist *));
    2.18  
    2.19 @@ -117,6 +119,7 @@ extern struct page *alloc_page_vma(unsig
    2.20  #define alloc_page_vma(gfp_mask, vma, addr) alloc_pages(gfp_mask, 0)
    2.21  #endif
    2.22  #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0)
    2.23 +#endif /* XEN */
    2.24  
    2.25  extern unsigned long FASTCALL(__get_free_pages(unsigned int __nocast gfp_mask, unsigned int order));
    2.26  extern unsigned long FASTCALL(get_zeroed_page(unsigned int __nocast gfp_mask));
     3.1 --- a/xen/include/asm-ia64/linux/README.origin	Tue Mar 07 17:08:20 2006 -0700
     3.2 +++ b/xen/include/asm-ia64/linux/README.origin	Tue Mar 07 17:12:39 2006 -0700
     3.3 @@ -14,7 +14,6 @@ initrd.h		-> linux/include/linux/initrd.
     3.4  jiffies.h		-> linux/include/linux/jiffies.h
     3.5  kmalloc_sizes.h		-> linux/include/linux/kmalloc_sizes.h
     3.6  linkage.h		-> linux/include/linux/linkage.h
     3.7 -mmzone.h		-> linux/include/linux/mmzone.h
     3.8  notifier.h		-> linux/include/linux/notifier.h
     3.9  numa.h			-> linux/include/linux/numa.h
    3.10  page-flags.h		-> linux/include/linux/page-flags.h
     4.1 --- a/xen/include/asm-ia64/linux/mmzone.h	Tue Mar 07 17:08:20 2006 -0700
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,592 +0,0 @@
     4.4 -#ifndef _LINUX_MMZONE_H
     4.5 -#define _LINUX_MMZONE_H
     4.6 -
     4.7 -#ifdef __KERNEL__
     4.8 -#ifndef __ASSEMBLY__
     4.9 -
    4.10 -#include <linux/config.h>
    4.11 -#include <linux/spinlock.h>
    4.12 -#include <linux/list.h>
    4.13 -#include <linux/wait.h>
    4.14 -#include <linux/cache.h>
    4.15 -#include <linux/threads.h>
    4.16 -#include <linux/numa.h>
    4.17 -#include <linux/init.h>
    4.18 -#include <asm/atomic.h>
    4.19 -
    4.20 -/* Free memory management - zoned buddy allocator.  */
    4.21 -#ifndef CONFIG_FORCE_MAX_ZONEORDER
    4.22 -#define MAX_ORDER 11
    4.23 -#else
    4.24 -#define MAX_ORDER CONFIG_FORCE_MAX_ZONEORDER
    4.25 -#endif
    4.26 -
    4.27 -struct free_area {
    4.28 -	struct list_head	free_list;
    4.29 -	unsigned long		nr_free;
    4.30 -};
    4.31 -
    4.32 -struct pglist_data;
    4.33 -
    4.34 -/*
    4.35 - * zone->lock and zone->lru_lock are two of the hottest locks in the kernel.
    4.36 - * So add a wild amount of padding here to ensure that they fall into separate
    4.37 - * cachelines.  There are very few zone structures in the machine, so space
    4.38 - * consumption is not a concern here.
    4.39 - */
    4.40 -#if defined(CONFIG_SMP)
    4.41 -struct zone_padding {
    4.42 -	char x[0];
    4.43 -} ____cacheline_maxaligned_in_smp;
    4.44 -#define ZONE_PADDING(name)	struct zone_padding name;
    4.45 -#else
    4.46 -#define ZONE_PADDING(name)
    4.47 -#endif
    4.48 -
    4.49 -struct per_cpu_pages {
    4.50 -	int count;		/* number of pages in the list */
    4.51 -	int low;		/* low watermark, refill needed */
    4.52 -	int high;		/* high watermark, emptying needed */
    4.53 -	int batch;		/* chunk size for buddy add/remove */
    4.54 -	struct list_head list;	/* the list of pages */
    4.55 -};
    4.56 -
    4.57 -struct per_cpu_pageset {
    4.58 -	struct per_cpu_pages pcp[2];	/* 0: hot.  1: cold */
    4.59 -#ifdef CONFIG_NUMA
    4.60 -	unsigned long numa_hit;		/* allocated in intended node */
    4.61 -	unsigned long numa_miss;	/* allocated in non intended node */
    4.62 -	unsigned long numa_foreign;	/* was intended here, hit elsewhere */
    4.63 -	unsigned long interleave_hit; 	/* interleaver prefered this zone */
    4.64 -	unsigned long local_node;	/* allocation from local node */
    4.65 -	unsigned long other_node;	/* allocation from other node */
    4.66 -#endif
    4.67 -} ____cacheline_aligned_in_smp;
    4.68 -
    4.69 -#ifdef CONFIG_NUMA
    4.70 -#define zone_pcp(__z, __cpu) ((__z)->pageset[(__cpu)])
    4.71 -#else
    4.72 -#define zone_pcp(__z, __cpu) (&(__z)->pageset[(__cpu)])
    4.73 -#endif
    4.74 -
    4.75 -#define ZONE_DMA		0
    4.76 -#define ZONE_NORMAL		1
    4.77 -#define ZONE_HIGHMEM		2
    4.78 -
    4.79 -#define MAX_NR_ZONES		3	/* Sync this with ZONES_SHIFT */
    4.80 -#define ZONES_SHIFT		2	/* ceil(log2(MAX_NR_ZONES)) */
    4.81 -
    4.82 -
    4.83 -/*
    4.84 - * When a memory allocation must conform to specific limitations (such
    4.85 - * as being suitable for DMA) the caller will pass in hints to the
    4.86 - * allocator in the gfp_mask, in the zone modifier bits.  These bits
    4.87 - * are used to select a priority ordered list of memory zones which
    4.88 - * match the requested limits.  GFP_ZONEMASK defines which bits within
    4.89 - * the gfp_mask should be considered as zone modifiers.  Each valid
    4.90 - * combination of the zone modifier bits has a corresponding list
    4.91 - * of zones (in node_zonelists).  Thus for two zone modifiers there
    4.92 - * will be a maximum of 4 (2 ** 2) zonelists, for 3 modifiers there will
    4.93 - * be 8 (2 ** 3) zonelists.  GFP_ZONETYPES defines the number of possible
    4.94 - * combinations of zone modifiers in "zone modifier space".
    4.95 - */
    4.96 -#define GFP_ZONEMASK	0x03
    4.97 -/*
    4.98 - * As an optimisation any zone modifier bits which are only valid when
    4.99 - * no other zone modifier bits are set (loners) should be placed in
   4.100 - * the highest order bits of this field.  This allows us to reduce the
   4.101 - * extent of the zonelists thus saving space.  For example in the case
   4.102 - * of three zone modifier bits, we could require up to eight zonelists.
   4.103 - * If the left most zone modifier is a "loner" then the highest valid
   4.104 - * zonelist would be four allowing us to allocate only five zonelists.
   4.105 - * Use the first form when the left most bit is not a "loner", otherwise
   4.106 - * use the second.
   4.107 - */
   4.108 -/* #define GFP_ZONETYPES	(GFP_ZONEMASK + 1) */		/* Non-loner */
   4.109 -#define GFP_ZONETYPES	((GFP_ZONEMASK + 1) / 2 + 1)		/* Loner */
   4.110 -
   4.111 -/*
   4.112 - * On machines where it is needed (eg PCs) we divide physical memory
   4.113 - * into multiple physical zones. On a PC we have 3 zones:
   4.114 - *
   4.115 - * ZONE_DMA	  < 16 MB	ISA DMA capable memory
   4.116 - * ZONE_NORMAL	16-896 MB	direct mapped by the kernel
   4.117 - * ZONE_HIGHMEM	 > 896 MB	only page cache and user processes
   4.118 - */
   4.119 -
   4.120 -struct zone {
   4.121 -	/* Fields commonly accessed by the page allocator */
   4.122 -	unsigned long		free_pages;
   4.123 -	unsigned long		pages_min, pages_low, pages_high;
   4.124 -	/*
   4.125 -	 * We don't know if the memory that we're going to allocate will be freeable
   4.126 -	 * or/and it will be released eventually, so to avoid totally wasting several
   4.127 -	 * GB of ram we must reserve some of the lower zone memory (otherwise we risk
   4.128 -	 * to run OOM on the lower zones despite there's tons of freeable ram
   4.129 -	 * on the higher zones). This array is recalculated at runtime if the
   4.130 -	 * sysctl_lowmem_reserve_ratio sysctl changes.
   4.131 -	 */
   4.132 -	unsigned long		lowmem_reserve[MAX_NR_ZONES];
   4.133 -
   4.134 -#ifdef CONFIG_NUMA
   4.135 -	struct per_cpu_pageset	*pageset[NR_CPUS];
   4.136 -#else
   4.137 -	struct per_cpu_pageset	pageset[NR_CPUS];
   4.138 -#endif
   4.139 -	/*
   4.140 -	 * free areas of different sizes
   4.141 -	 */
   4.142 -	spinlock_t		lock;
   4.143 -	struct free_area	free_area[MAX_ORDER];
   4.144 -
   4.145 -
   4.146 -	ZONE_PADDING(_pad1_)
   4.147 -
   4.148 -	/* Fields commonly accessed by the page reclaim scanner */
   4.149 -	spinlock_t		lru_lock;	
   4.150 -	struct list_head	active_list;
   4.151 -	struct list_head	inactive_list;
   4.152 -	unsigned long		nr_scan_active;
   4.153 -	unsigned long		nr_scan_inactive;
   4.154 -	unsigned long		nr_active;
   4.155 -	unsigned long		nr_inactive;
   4.156 -	unsigned long		pages_scanned;	   /* since last reclaim */
   4.157 -	int			all_unreclaimable; /* All pages pinned */
   4.158 -
   4.159 -	/*
   4.160 -	 * Does the allocator try to reclaim pages from the zone as soon
   4.161 -	 * as it fails a watermark_ok() in __alloc_pages?
   4.162 -	 */
   4.163 -	int			reclaim_pages;
   4.164 -	/* A count of how many reclaimers are scanning this zone */
   4.165 -	atomic_t		reclaim_in_progress;
   4.166 -
   4.167 -	/*
   4.168 -	 * prev_priority holds the scanning priority for this zone.  It is
   4.169 -	 * defined as the scanning priority at which we achieved our reclaim
   4.170 -	 * target at the previous try_to_free_pages() or balance_pgdat()
   4.171 -	 * invokation.
   4.172 -	 *
   4.173 -	 * We use prev_priority as a measure of how much stress page reclaim is
   4.174 -	 * under - it drives the swappiness decision: whether to unmap mapped
   4.175 -	 * pages.
   4.176 -	 *
   4.177 -	 * temp_priority is used to remember the scanning priority at which
   4.178 -	 * this zone was successfully refilled to free_pages == pages_high.
   4.179 -	 *
   4.180 -	 * Access to both these fields is quite racy even on uniprocessor.  But
   4.181 -	 * it is expected to average out OK.
   4.182 -	 */
   4.183 -	int temp_priority;
   4.184 -	int prev_priority;
   4.185 -
   4.186 -
   4.187 -	ZONE_PADDING(_pad2_)
   4.188 -	/* Rarely used or read-mostly fields */
   4.189 -
   4.190 -	/*
   4.191 -	 * wait_table		-- the array holding the hash table
   4.192 -	 * wait_table_size	-- the size of the hash table array
   4.193 -	 * wait_table_bits	-- wait_table_size == (1 << wait_table_bits)
   4.194 -	 *
   4.195 -	 * The purpose of all these is to keep track of the people
   4.196 -	 * waiting for a page to become available and make them
   4.197 -	 * runnable again when possible. The trouble is that this
   4.198 -	 * consumes a lot of space, especially when so few things
   4.199 -	 * wait on pages at a given time. So instead of using
   4.200 -	 * per-page waitqueues, we use a waitqueue hash table.
   4.201 -	 *
   4.202 -	 * The bucket discipline is to sleep on the same queue when
   4.203 -	 * colliding and wake all in that wait queue when removing.
   4.204 -	 * When something wakes, it must check to be sure its page is
   4.205 -	 * truly available, a la thundering herd. The cost of a
   4.206 -	 * collision is great, but given the expected load of the
   4.207 -	 * table, they should be so rare as to be outweighed by the
   4.208 -	 * benefits from the saved space.
   4.209 -	 *
   4.210 -	 * __wait_on_page_locked() and unlock_page() in mm/filemap.c, are the
   4.211 -	 * primary users of these fields, and in mm/page_alloc.c
   4.212 -	 * free_area_init_core() performs the initialization of them.
   4.213 -	 */
   4.214 -	wait_queue_head_t	* wait_table;
   4.215 -	unsigned long		wait_table_size;
   4.216 -	unsigned long		wait_table_bits;
   4.217 -
   4.218 -	/*
   4.219 -	 * Discontig memory support fields.
   4.220 -	 */
   4.221 -	struct pglist_data	*zone_pgdat;
   4.222 -	struct page		*zone_mem_map;
   4.223 -	/* zone_start_pfn == zone_start_paddr >> PAGE_SHIFT */
   4.224 -	unsigned long		zone_start_pfn;
   4.225 -
   4.226 -	unsigned long		spanned_pages;	/* total size, including holes */
   4.227 -	unsigned long		present_pages;	/* amount of memory (excluding holes) */
   4.228 -
   4.229 -	/*
   4.230 -	 * rarely used fields:
   4.231 -	 */
   4.232 -	char			*name;
   4.233 -} ____cacheline_maxaligned_in_smp;
   4.234 -
   4.235 -
   4.236 -/*
   4.237 - * The "priority" of VM scanning is how much of the queues we will scan in one
   4.238 - * go. A value of 12 for DEF_PRIORITY implies that we will scan 1/4096th of the
   4.239 - * queues ("queue_length >> 12") during an aging round.
   4.240 - */
   4.241 -#define DEF_PRIORITY 12
   4.242 -
   4.243 -/*
   4.244 - * One allocation request operates on a zonelist. A zonelist
   4.245 - * is a list of zones, the first one is the 'goal' of the
   4.246 - * allocation, the other zones are fallback zones, in decreasing
   4.247 - * priority.
   4.248 - *
   4.249 - * Right now a zonelist takes up less than a cacheline. We never
   4.250 - * modify it apart from boot-up, and only a few indices are used,
   4.251 - * so despite the zonelist table being relatively big, the cache
   4.252 - * footprint of this construct is very small.
   4.253 - */
   4.254 -struct zonelist {
   4.255 -	struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited
   4.256 -};
   4.257 -
   4.258 -
   4.259 -/*
   4.260 - * The pg_data_t structure is used in machines with CONFIG_DISCONTIGMEM
   4.261 - * (mostly NUMA machines?) to denote a higher-level memory zone than the
   4.262 - * zone denotes.
   4.263 - *
   4.264 - * On NUMA machines, each NUMA node would have a pg_data_t to describe
   4.265 - * it's memory layout.
   4.266 - *
   4.267 - * Memory statistics and page replacement data structures are maintained on a
   4.268 - * per-zone basis.
   4.269 - */
   4.270 -struct bootmem_data;
   4.271 -typedef struct pglist_data {
   4.272 -	struct zone node_zones[MAX_NR_ZONES];
   4.273 -	struct zonelist node_zonelists[GFP_ZONETYPES];
   4.274 -	int nr_zones;
   4.275 -#ifdef CONFIG_FLAT_NODE_MEM_MAP
   4.276 -	struct page *node_mem_map;
   4.277 -#endif
   4.278 -	struct bootmem_data *bdata;
   4.279 -	unsigned long node_start_pfn;
   4.280 -	unsigned long node_present_pages; /* total number of physical pages */
   4.281 -	unsigned long node_spanned_pages; /* total size of physical page
   4.282 -					     range, including holes */
   4.283 -	int node_id;
   4.284 -	struct pglist_data *pgdat_next;
   4.285 -	wait_queue_head_t kswapd_wait;
   4.286 -	struct task_struct *kswapd;
   4.287 -	int kswapd_max_order;
   4.288 -} pg_data_t;
   4.289 -
   4.290 -#define node_present_pages(nid)	(NODE_DATA(nid)->node_present_pages)
   4.291 -#define node_spanned_pages(nid)	(NODE_DATA(nid)->node_spanned_pages)
   4.292 -#ifdef CONFIG_FLAT_NODE_MEM_MAP
   4.293 -#define pgdat_page_nr(pgdat, pagenr)	((pgdat)->node_mem_map + (pagenr))
   4.294 -#else
   4.295 -#define pgdat_page_nr(pgdat, pagenr)	mfn_to_page((pgdat)->node_start_pfn + (pagenr))
   4.296 -#endif
   4.297 -#define nid_page_nr(nid, pagenr) 	pgdat_page_nr(NODE_DATA(nid),(pagenr))
   4.298 -
   4.299 -extern struct pglist_data *pgdat_list;
   4.300 -
   4.301 -void __get_zone_counts(unsigned long *active, unsigned long *inactive,
   4.302 -			unsigned long *free, struct pglist_data *pgdat);
   4.303 -void get_zone_counts(unsigned long *active, unsigned long *inactive,
   4.304 -			unsigned long *free);
   4.305 -void build_all_zonelists(void);
   4.306 -void wakeup_kswapd(struct zone *zone, int order);
   4.307 -int zone_watermark_ok(struct zone *z, int order, unsigned long mark,
   4.308 -		int alloc_type, int can_try_harder, int gfp_high);
   4.309 -
   4.310 -#ifdef CONFIG_HAVE_MEMORY_PRESENT
   4.311 -void memory_present(int nid, unsigned long start, unsigned long end);
   4.312 -#else
   4.313 -static inline void memory_present(int nid, unsigned long start, unsigned long end) {}
   4.314 -#endif
   4.315 -
   4.316 -#ifdef CONFIG_NEED_NODE_MEMMAP_SIZE
   4.317 -unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
   4.318 -#endif
   4.319 -
   4.320 -/*
   4.321 - * zone_idx() returns 0 for the ZONE_DMA zone, 1 for the ZONE_NORMAL zone, etc.
   4.322 - */
   4.323 -#define zone_idx(zone)		((zone) - (zone)->zone_pgdat->node_zones)
   4.324 -
   4.325 -/**
   4.326 - * for_each_pgdat - helper macro to iterate over all nodes
   4.327 - * @pgdat - pointer to a pg_data_t variable
   4.328 - *
   4.329 - * Meant to help with common loops of the form
   4.330 - * pgdat = pgdat_list;
   4.331 - * while(pgdat) {
   4.332 - * 	...
   4.333 - * 	pgdat = pgdat->pgdat_next;
   4.334 - * }
   4.335 - */
   4.336 -#define for_each_pgdat(pgdat) \
   4.337 -	for (pgdat = pgdat_list; pgdat; pgdat = pgdat->pgdat_next)
   4.338 -
   4.339 -/*
   4.340 - * next_zone - helper magic for for_each_zone()
   4.341 - * Thanks to William Lee Irwin III for this piece of ingenuity.
   4.342 - */
   4.343 -static inline struct zone *next_zone(struct zone *zone)
   4.344 -{
   4.345 -	pg_data_t *pgdat = zone->zone_pgdat;
   4.346 -
   4.347 -	if (zone < pgdat->node_zones + MAX_NR_ZONES - 1)
   4.348 -		zone++;
   4.349 -	else if (pgdat->pgdat_next) {
   4.350 -		pgdat = pgdat->pgdat_next;
   4.351 -		zone = pgdat->node_zones;
   4.352 -	} else
   4.353 -		zone = NULL;
   4.354 -
   4.355 -	return zone;
   4.356 -}
   4.357 -
   4.358 -/**
   4.359 - * for_each_zone - helper macro to iterate over all memory zones
   4.360 - * @zone - pointer to struct zone variable
   4.361 - *
   4.362 - * The user only needs to declare the zone variable, for_each_zone
   4.363 - * fills it in. This basically means for_each_zone() is an
   4.364 - * easier to read version of this piece of code:
   4.365 - *
   4.366 - * for (pgdat = pgdat_list; pgdat; pgdat = pgdat->node_next)
   4.367 - * 	for (i = 0; i < MAX_NR_ZONES; ++i) {
   4.368 - * 		struct zone * z = pgdat->node_zones + i;
   4.369 - * 		...
   4.370 - * 	}
   4.371 - * }
   4.372 - */
   4.373 -#define for_each_zone(zone) \
   4.374 -	for (zone = pgdat_list->node_zones; zone; zone = next_zone(zone))
   4.375 -
   4.376 -static inline int is_highmem_idx(int idx)
   4.377 -{
   4.378 -	return (idx == ZONE_HIGHMEM);
   4.379 -}
   4.380 -
   4.381 -static inline int is_normal_idx(int idx)
   4.382 -{
   4.383 -	return (idx == ZONE_NORMAL);
   4.384 -}
   4.385 -/**
   4.386 - * is_highmem - helper function to quickly check if a struct zone is a 
   4.387 - *              highmem zone or not.  This is an attempt to keep references
   4.388 - *              to ZONE_{DMA/NORMAL/HIGHMEM/etc} in general code to a minimum.
   4.389 - * @zone - pointer to struct zone variable
   4.390 - */
   4.391 -static inline int is_highmem(struct zone *zone)
   4.392 -{
   4.393 -	return zone == zone->zone_pgdat->node_zones + ZONE_HIGHMEM;
   4.394 -}
   4.395 -
   4.396 -static inline int is_normal(struct zone *zone)
   4.397 -{
   4.398 -	return zone == zone->zone_pgdat->node_zones + ZONE_NORMAL;
   4.399 -}
   4.400 -
   4.401 -/* These two functions are used to setup the per zone pages min values */
   4.402 -struct ctl_table;
   4.403 -struct file;
   4.404 -int min_free_kbytes_sysctl_handler(struct ctl_table *, int, struct file *, 
   4.405 -					void __user *, size_t *, loff_t *);
   4.406 -extern int sysctl_lowmem_reserve_ratio[MAX_NR_ZONES-1];
   4.407 -int lowmem_reserve_ratio_sysctl_handler(struct ctl_table *, int, struct file *,
   4.408 -					void __user *, size_t *, loff_t *);
   4.409 -
   4.410 -#include <linux/topology.h>
   4.411 -/* Returns the number of the current Node. */
   4.412 -#define numa_node_id()		(cpu_to_node(raw_smp_processor_id()))
   4.413 -
   4.414 -#ifndef CONFIG_NEED_MULTIPLE_NODES
   4.415 -
   4.416 -extern struct pglist_data contig_page_data;
   4.417 -#define NODE_DATA(nid)		(&contig_page_data)
   4.418 -#define NODE_MEM_MAP(nid)	mem_map
   4.419 -#define MAX_NODES_SHIFT		1
   4.420 -#define pfn_to_nid(pfn)		(0)
   4.421 -
   4.422 -#else /* CONFIG_NEED_MULTIPLE_NODES */
   4.423 -
   4.424 -#include <asm/mmzone.h>
   4.425 -
   4.426 -#endif /* !CONFIG_NEED_MULTIPLE_NODES */
   4.427 -
   4.428 -#ifdef CONFIG_SPARSEMEM
   4.429 -#include <asm/sparsemem.h>
   4.430 -#endif
   4.431 -
   4.432 -#if BITS_PER_LONG == 32 || defined(ARCH_HAS_ATOMIC_UNSIGNED)
   4.433 -/*
   4.434 - * with 32 bit page->flags field, we reserve 8 bits for node/zone info.
   4.435 - * there are 3 zones (2 bits) and this leaves 8-2=6 bits for nodes.
   4.436 - */
   4.437 -#define FLAGS_RESERVED		8
   4.438 -
   4.439 -#elif BITS_PER_LONG == 64
   4.440 -/*
   4.441 - * with 64 bit flags field, there's plenty of room.
   4.442 - */
   4.443 -#define FLAGS_RESERVED		32
   4.444 -
   4.445 -#else
   4.446 -
   4.447 -#error BITS_PER_LONG not defined
   4.448 -
   4.449 -#endif
   4.450 -
   4.451 -#ifndef CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID
   4.452 -#define early_pfn_to_nid(nid)  (0UL)
   4.453 -#endif
   4.454 -
   4.455 -#define pfn_to_section_nr(pfn) ((pfn) >> PFN_SECTION_SHIFT)
   4.456 -#define section_nr_to_pfn(sec) ((sec) << PFN_SECTION_SHIFT)
   4.457 -
   4.458 -#ifdef CONFIG_SPARSEMEM
   4.459 -
   4.460 -/*
   4.461 - * SECTION_SHIFT    		#bits space required to store a section #
   4.462 - *
   4.463 - * PA_SECTION_SHIFT		physical address to/from section number
   4.464 - * PFN_SECTION_SHIFT		pfn to/from section number
   4.465 - */
   4.466 -#define SECTIONS_SHIFT		(MAX_PHYSMEM_BITS - SECTION_SIZE_BITS)
   4.467 -
   4.468 -#define PA_SECTION_SHIFT	(SECTION_SIZE_BITS)
   4.469 -#define PFN_SECTION_SHIFT	(SECTION_SIZE_BITS - PAGE_SHIFT)
   4.470 -
   4.471 -#define NR_MEM_SECTIONS		(1UL << SECTIONS_SHIFT)
   4.472 -
   4.473 -#define PAGES_PER_SECTION       (1UL << PFN_SECTION_SHIFT)
   4.474 -#define PAGE_SECTION_MASK	(~(PAGES_PER_SECTION-1))
   4.475 -
   4.476 -#if (MAX_ORDER - 1 + PAGE_SHIFT) > SECTION_SIZE_BITS
   4.477 -#error Allocator MAX_ORDER exceeds SECTION_SIZE
   4.478 -#endif
   4.479 -
   4.480 -struct page;
   4.481 -struct mem_section {
   4.482 -	/*
   4.483 -	 * This is, logically, a pointer to an array of struct
   4.484 -	 * pages.  However, it is stored with some other magic.
   4.485 -	 * (see sparse.c::sparse_init_one_section())
   4.486 -	 *
   4.487 -	 * Making it a UL at least makes someone do a cast
   4.488 -	 * before using it wrong.
   4.489 -	 */
   4.490 -	unsigned long section_mem_map;
   4.491 -};
   4.492 -
   4.493 -extern struct mem_section mem_section[NR_MEM_SECTIONS];
   4.494 -
   4.495 -static inline struct mem_section *__nr_to_section(unsigned long nr)
   4.496 -{
   4.497 -	return &mem_section[nr];
   4.498 -}
   4.499 -
   4.500 -/*
   4.501 - * We use the lower bits of the mem_map pointer to store
   4.502 - * a little bit of information.  There should be at least
   4.503 - * 3 bits here due to 32-bit alignment.
   4.504 - */
   4.505 -#define	SECTION_MARKED_PRESENT	(1UL<<0)
   4.506 -#define SECTION_HAS_MEM_MAP	(1UL<<1)
   4.507 -#define SECTION_MAP_LAST_BIT	(1UL<<2)
   4.508 -#define SECTION_MAP_MASK	(~(SECTION_MAP_LAST_BIT-1))
   4.509 -
   4.510 -static inline struct page *__section_mem_map_addr(struct mem_section *section)
   4.511 -{
   4.512 -	unsigned long map = section->section_mem_map;
   4.513 -	map &= SECTION_MAP_MASK;
   4.514 -	return (struct page *)map;
   4.515 -}
   4.516 -
   4.517 -static inline int valid_section(struct mem_section *section)
   4.518 -{
   4.519 -	return (section->section_mem_map & SECTION_MARKED_PRESENT);
   4.520 -}
   4.521 -
   4.522 -static inline int section_has_mem_map(struct mem_section *section)
   4.523 -{
   4.524 -	return (section->section_mem_map & SECTION_HAS_MEM_MAP);
   4.525 -}
   4.526 -
   4.527 -static inline int valid_section_nr(unsigned long nr)
   4.528 -{
   4.529 -	return valid_section(__nr_to_section(nr));
   4.530 -}
   4.531 -
   4.532 -/*
   4.533 - * Given a kernel address, find the home node of the underlying memory.
   4.534 - */
   4.535 -#define kvaddr_to_nid(kaddr)	pfn_to_nid(__pa(kaddr) >> PAGE_SHIFT)
   4.536 -
   4.537 -static inline struct mem_section *__pfn_to_section(unsigned long pfn)
   4.538 -{
   4.539 -	return __nr_to_section(pfn_to_section_nr(pfn));
   4.540 -}
   4.541 -
   4.542 -#define mfn_to_page(pfn) 						\
   4.543 -({ 									\
   4.544 -	unsigned long __pfn = (pfn);					\
   4.545 -	__section_mem_map_addr(__pfn_to_section(__pfn)) + __pfn;	\
   4.546 -})
   4.547 -#define page_to_mfn(page)						\
   4.548 -({									\
   4.549 -	page - __section_mem_map_addr(__nr_to_section(			\
   4.550 -		page_to_section(page)));				\
   4.551 -})
   4.552 -
   4.553 -static inline int mfn_valid(unsigned long pfn)
   4.554 -{
   4.555 -	if (pfn_to_section_nr(pfn) >= NR_MEM_SECTIONS)
   4.556 -		return 0;
   4.557 -	return valid_section(__nr_to_section(pfn_to_section_nr(pfn)));
   4.558 -}
   4.559 -
   4.560 -/*
   4.561 - * These are _only_ used during initialisation, therefore they
   4.562 - * can use __initdata ...  They could have names to indicate
   4.563 - * this restriction.
   4.564 - */
   4.565 -#ifdef CONFIG_NUMA
   4.566 -#define pfn_to_nid		early_pfn_to_nid
   4.567 -#endif
   4.568 -
   4.569 -#define pfn_to_pgdat(pfn)						\
   4.570 -({									\
   4.571 -	NODE_DATA(pfn_to_nid(pfn));					\
   4.572 -})
   4.573 -
   4.574 -#define early_mfn_valid(pfn)	mfn_valid(pfn)
   4.575 -void sparse_init(void);
   4.576 -#else
   4.577 -#define sparse_init()	do {} while (0)
   4.578 -#endif /* CONFIG_SPARSEMEM */
   4.579 -
   4.580 -#ifdef CONFIG_NODES_SPAN_OTHER_NODES
   4.581 -#define early_pfn_in_nid(pfn, nid)	(early_pfn_to_nid(pfn) == (nid))
   4.582 -#else
   4.583 -#define early_pfn_in_nid(pfn, nid)	(1)
   4.584 -#endif
   4.585 -
   4.586 -#ifndef early_mfn_valid
   4.587 -#define early_mfn_valid(pfn)	(1)
   4.588 -#endif
   4.589 -
   4.590 -void memory_present(int nid, unsigned long start, unsigned long end);
   4.591 -unsigned long __init node_memmap_size_bytes(int, unsigned long, unsigned long);
   4.592 -
   4.593 -#endif /* !__ASSEMBLY__ */
   4.594 -#endif /* __KERNEL__ */
   4.595 -#endif /* _LINUX_MMZONE_H */