mm: use two zonelist that are filtered by GFP mask
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / include / linux / gfp.h
index e865d51f1c748ec9517c1ee8b79e3355006e58bc..e1c6064cb6c74a1403b65f7c0d2afdb49111a139 100644 (file)
@@ -151,17 +151,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