]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/blobdiff - mm/mempolicy.c
mm, page_alloc: avoid looking up the first zone in a zonelist twice
[mirror_ubuntu-zesty-kernel.git] / mm / mempolicy.c
index 7f80ebcd655241051d1b8948ffe736e6b18c5ef7..297d6854f84920f4420d5929fd3bc1084dd8a15e 100644 (file)
@@ -1739,18 +1739,18 @@ unsigned int mempolicy_slab_node(void)
                return interleave_nodes(policy);
 
        case MPOL_BIND: {
+               struct zoneref *z;
+
                /*
                 * Follow bind policy behavior and start allocation at the
                 * first node.
                 */
                struct zonelist *zonelist;
-               struct zone *zone;
                enum zone_type highest_zoneidx = gfp_zone(GFP_KERNEL);
                zonelist = &NODE_DATA(node)->node_zonelists[0];
-               (void)first_zones_zonelist(zonelist, highest_zoneidx,
-                                                       &policy->v.nodes,
-                                                       &zone);
-               return zone ? zone->node : node;
+               z = first_zones_zonelist(zonelist, highest_zoneidx,
+                                                       &policy->v.nodes);
+               return z->zone ? z->zone->node : node;
        }
 
        default:
@@ -2266,7 +2266,7 @@ static void sp_free(struct sp_node *n)
 int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long addr)
 {
        struct mempolicy *pol;
-       struct zone *zone;
+       struct zoneref *z;
        int curnid = page_to_nid(page);
        unsigned long pgoff;
        int thiscpu = raw_smp_processor_id();
@@ -2298,6 +2298,7 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
                break;
 
        case MPOL_BIND:
+
                /*
                 * allows binding to multiple nodes.
                 * use current page if in policy nodemask,
@@ -2306,11 +2307,11 @@ int mpol_misplaced(struct page *page, struct vm_area_struct *vma, unsigned long
                 */
                if (node_isset(curnid, pol->v.nodes))
                        goto out;
-               (void)first_zones_zonelist(
+               z = first_zones_zonelist(
                                node_zonelist(numa_node_id(), GFP_HIGHUSER),
                                gfp_zone(GFP_HIGHUSER),
-                               &pol->v.nodes, &zone);
-               polnid = zone->node;
+                               &pol->v.nodes);
+               polnid = z->zone->node;
                break;
 
        default: