page allocator: do not check NUMA node ID when the caller knows the node is valid
[sfrench/cifs-2.6.git] / include / linux / gfp.h
index 0bbc15f5453642e2c5057028322b29738cbf8a47..4efa33088a824b59974c4509e83461d4b8e31669 100644 (file)
@@ -5,6 +5,7 @@
 #include <linux/stddef.h>
 #include <linux/linkage.h>
 #include <linux/topology.h>
+#include <linux/mmdebug.h>
 
 struct vm_area_struct;
 
@@ -85,6 +86,9 @@ struct vm_area_struct;
                        __GFP_NOWARN|__GFP_REPEAT|__GFP_NOFAIL|\
                        __GFP_NORETRY|__GFP_NOMEMALLOC)
 
+/* Control slab gfp mask during early boot */
+#define SLAB_GFP_BOOT_MASK __GFP_BITS_MASK & ~(__GFP_WAIT|__GFP_IO|__GFP_FS)
+
 /* Control allocation constraints */
 #define GFP_CONSTRAINT_MASK (__GFP_HARDWALL|__GFP_THISNODE)
 
@@ -169,30 +173,19 @@ static inline void arch_alloc_page(struct page *page, int order) { }
 #endif
 
 struct page *
-__alloc_pages_internal(gfp_t gfp_mask, unsigned int order,
+__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
                       struct zonelist *zonelist, nodemask_t *nodemask);
 
 static inline struct page *
 __alloc_pages(gfp_t gfp_mask, unsigned int order,
                struct zonelist *zonelist)
 {
-       return __alloc_pages_internal(gfp_mask, order, zonelist, NULL);
-}
-
-static inline struct page *
-__alloc_pages_nodemask(gfp_t gfp_mask, unsigned int order,
-               struct zonelist *zonelist, nodemask_t *nodemask)
-{
-       return __alloc_pages_internal(gfp_mask, order, zonelist, nodemask);
+       return __alloc_pages_nodemask(gfp_mask, order, zonelist, NULL);
 }
 
-
 static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
                                                unsigned int order)
 {
-       if (unlikely(order >= MAX_ORDER))
-               return NULL;
-
        /* Unknown node is current node */
        if (nid < 0)
                nid = numa_node_id();
@@ -200,15 +193,20 @@ static inline struct page *alloc_pages_node(int nid, gfp_t gfp_mask,
        return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
 }
 
+static inline struct page *alloc_pages_exact_node(int nid, gfp_t gfp_mask,
+                                               unsigned int order)
+{
+       VM_BUG_ON(nid < 0 || nid >= MAX_NUMNODES);
+
+       return __alloc_pages(gfp_mask, order, node_zonelist(nid, gfp_mask));
+}
+
 #ifdef CONFIG_NUMA
 extern struct page *alloc_pages_current(gfp_t gfp_mask, unsigned order);
 
 static inline struct page *
 alloc_pages(gfp_t gfp_mask, unsigned int order)
 {
-       if (unlikely(order >= MAX_ORDER))
-               return NULL;
-
        return alloc_pages_current(gfp_mask, order);
 }
 extern struct page *alloc_page_vma(gfp_t gfp_mask,