diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/gfp.h | 19 | ||||
| -rw-r--r-- | include/linux/mmzone.h | 14 |
2 files changed, 22 insertions, 11 deletions
diff --git a/include/linux/gfp.h b/include/linux/gfp.h index 10021357c093..437572e2240b 100644 --- a/include/linux/gfp.h +++ b/include/linux/gfp.h @@ -39,18 +39,25 @@ * can allocate highmem pages, the *get*page*() variants return * virtual kernel addresses to the allocated page(s). */ -extern struct page * FASTCALL(_alloc_pages(unsigned int gfp_mask, unsigned int order)); extern struct page * FASTCALL(__alloc_pages(unsigned int gfp_mask, unsigned int order, struct zonelist *zonelist)); extern struct page * alloc_pages_node(int nid, unsigned int gfp_mask, unsigned int order); +/* + * We get the zone list from the current node and the gfp_mask. + * This zone list contains a maximum of MAXNODES*MAX_NR_ZONES zones. + * + * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets + * optimized to &contig_page_data at compile-time. + */ static inline struct page * alloc_pages(unsigned int gfp_mask, unsigned int order) { - /* - * Gets optimized away by the compiler. - */ - if (order >= MAX_ORDER) + pg_data_t *pgdat = NODE_DATA(numa_node_id()); + unsigned int idx = (gfp_mask & GFP_ZONEMASK); + + if (unlikely(order >= MAX_ORDER)) return NULL; - return _alloc_pages(gfp_mask, order); + + return __alloc_pages(gfp_mask, order, pgdat->node_zonelists + idx); } #define alloc_page(gfp_mask) alloc_pages(gfp_mask, 0) diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h index 5cdd464992da..580c39c4dcc1 100644 --- a/include/linux/mmzone.h +++ b/include/linux/mmzone.h @@ -10,11 +10,14 @@ #include <linux/wait.h> #include <linux/cache.h> #include <asm/atomic.h> +#ifdef CONFIG_DISCONTIGMEM +#include <asm/numnodes.h> +#endif +#ifndef MAX_NUMNODES +#define MAX_NUMNODES 1 +#endif -/* - * Free memory management - zoned buddy allocator. - */ - +/* Free memory management - zoned buddy allocator. */ #ifndef CONFIG_FORCE_MAX_ZONEORDER #define MAX_ORDER 11 #else @@ -137,7 +140,7 @@ struct zone { * footprint of this construct is very small. */ struct zonelist { - struct zone *zones[MAX_NR_ZONES+1]; // NULL delimited + struct zone *zones[MAX_NUMNODES * MAX_NR_ZONES + 1]; // NULL delimited }; #define GFP_ZONEMASK 0x0f @@ -190,6 +193,7 @@ extern void calculate_totalpages (pg_data_t *pgdat, unsigned long *zones_size, extern void free_area_init_core(pg_data_t *pgdat, unsigned long *zones_size, unsigned long *zholes_size); void get_zone_counts(unsigned long *active, unsigned long *inactive); +extern void build_all_zonelists(void); extern pg_data_t contig_page_data; |
