]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/gfp.h
Merge with /home/shaggy/git/linus-clean/
[karo-tx-linux.git] / include / linux / gfp.h
index 23279d8f19b1a05cd5a09b9403bea9a17ed8baca..20f9148e38d930e23d33c8c80376c7e6018ea9e0 100644 (file)
@@ -11,9 +11,16 @@ struct vm_area_struct;
 /*
  * GFP bitmasks..
  */
-/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low two bits) */
+/* Zone modifiers in GFP_ZONEMASK (see linux/mmzone.h - low three bits) */
 #define __GFP_DMA      ((__force gfp_t)0x01u)
 #define __GFP_HIGHMEM  ((__force gfp_t)0x02u)
+#ifdef CONFIG_DMA_IS_DMA32
+#define __GFP_DMA32    ((__force gfp_t)0x01)   /* ZONE_DMA is ZONE_DMA32 */
+#elif BITS_PER_LONG < 64
+#define __GFP_DMA32    ((__force gfp_t)0x00)   /* ZONE_NORMAL is ZONE_DMA32 */
+#else
+#define __GFP_DMA32    ((__force gfp_t)0x04)   /* Has own ZONE_DMA32 */
+#endif
 
 /*
  * Action modifiers - doesn't change the zoning
@@ -50,6 +57,7 @@ struct vm_area_struct;
                        __GFP_NOFAIL|__GFP_NORETRY|__GFP_NO_GROW|__GFP_COMP| \
                        __GFP_NOMEMALLOC|__GFP_HARDWALL)
 
+/* GFP_ATOMIC means both !wait (__GFP_WAIT not set) and use emergency pool */
 #define GFP_ATOMIC     (__GFP_HIGH)
 #define GFP_NOIO       (__GFP_WAIT)
 #define GFP_NOFS       (__GFP_WAIT | __GFP_IO)
@@ -63,7 +71,16 @@ struct vm_area_struct;
 
 #define GFP_DMA                __GFP_DMA
 
-#define gfp_zone(mask) ((__force int)((mask) & (__force gfp_t)GFP_ZONEMASK))
+/* 4GB DMA on some platforms */
+#define GFP_DMA32      __GFP_DMA32
+
+
+static inline int gfp_zone(gfp_t gfp)
+{
+       int zone = GFP_ZONEMASK & (__force int) gfp;
+       BUG_ON(zone >= GFP_ZONETYPES);
+       return zone;
+}
 
 /*
  * There is only one page-allocator function, and two main namespaces to
@@ -93,6 +110,10 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
        if (unlikely(order >= MAX_ORDER))
                return NULL;
 
+       /* Unknown node is current node */
+       if (nid < 0)
+               nid = numa_node_id();
+
        return __alloc_pages(gfp_mask, order,
                NODE_DATA(nid)->node_zonelists + gfp_zone(gfp_mask));
 }