]> err.no Git - linux-2.6/blobdiff - include/linux/gfp.h
Merge git://git.kernel.org/pub/scm/linux/kernel/git/tglx/linux-2.6-hrt
[linux-2.6] / include / linux / gfp.h
index e865d51f1c748ec9517c1ee8b79e3355006e58bc..c37653b6843fb81bdd60f4e07fd54ec3d9e8c3f3 100644 (file)
@@ -119,29 +119,22 @@ static inline int allocflags_to_migratetype(gfp_t gfp_flags)
 
 static inline enum zone_type gfp_zone(gfp_t flags)
 {
-       int base = 0;
-
-#ifdef CONFIG_NUMA
-       if (flags & __GFP_THISNODE)
-               base = MAX_NR_ZONES;
-#endif
-
 #ifdef CONFIG_ZONE_DMA
        if (flags & __GFP_DMA)
-               return base + ZONE_DMA;
+               return ZONE_DMA;
 #endif
 #ifdef CONFIG_ZONE_DMA32
        if (flags & __GFP_DMA32)
-               return base + ZONE_DMA32;
+               return ZONE_DMA32;
 #endif
        if ((flags & (__GFP_HIGHMEM | __GFP_MOVABLE)) ==
                        (__GFP_HIGHMEM | __GFP_MOVABLE))
-               return base + ZONE_MOVABLE;
+               return ZONE_MOVABLE;
 #ifdef CONFIG_HIGHMEM
        if (flags & __GFP_HIGHMEM)
-               return base + ZONE_HIGHMEM;
+               return ZONE_HIGHMEM;
 #endif
-       return base + ZONE_NORMAL;
+       return ZONE_NORMAL;
 }
 
 /*
@@ -151,17 +144,26 @@ static inline enum zone_type gfp_zone(gfp_t flags)
  * virtual kernel addresses to the allocated page(s).
  */
 
+static inline int gfp_zonelist(gfp_t flags)
+{
+       if (NUMA_BUILD && unlikely(flags & __GFP_THISNODE))
+               return 1;
+
+       return 0;
+}
+
 /*
  * 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.
- * There are many zonelists per node, two for each active zone.
+ * There are two zonelists per node, one for all zones with memory and
+ * one containing just zones from the node the zonelist belongs to.
  *
  * For the normal case of non-DISCONTIGMEM systems the NODE_DATA() gets
  * optimized to &contig_page_data at compile-time.
  */
 static inline struct zonelist *node_zonelist(int nid, gfp_t flags)
 {
-       return NODE_DATA(nid)->node_zonelists + gfp_zone(flags);
+       return NODE_DATA(nid)->node_zonelists + gfp_zonelist(flags);
 }
 
 #ifndef HAVE_ARCH_FREE_PAGE
@@ -173,6 +175,10 @@ static inline void arch_alloc_page(struct page *page, int order) { }
 
 extern struct page *__alloc_pages(gfp_t, unsigned int, struct zonelist *);
 
+extern struct page *
+__alloc_pages_nodemask(gfp_t, unsigned int,
+                               struct zonelist *, nodemask_t *nodemask);
+
 static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
                                                unsigned int order)
 {