]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - mm/compaction.c
mm: reduce try_to_compact_pages parameters
[mirror_ubuntu-bionic-kernel.git] / mm / compaction.c
index 546e571e9d60d1df57155833ab0e2d6afcb33ac0..9c7e6909dd29089f308902778164812d2c1ad216 100644 (file)
@@ -1335,22 +1335,20 @@ int sysctl_extfrag_threshold = 500;
 
 /**
  * try_to_compact_pages - Direct compact to satisfy a high-order allocation
- * @zonelist: The zonelist used for the current allocation
- * @order: The order of the current allocation
  * @gfp_mask: The GFP mask of the current allocation
- * @nodemask: The allowed nodes to allocate from
+ * @order: The order of the current allocation
+ * @alloc_flags: The allocation flags of the current allocation
+ * @ac: The context of current allocation
  * @mode: The migration mode for async, sync light, or sync migration
  * @contended: Return value that determines if compaction was aborted due to
  *            need_resched() or lock contention
  *
  * This is the main entry point for direct page compaction.
  */
-unsigned long try_to_compact_pages(struct zonelist *zonelist,
-                       int order, gfp_t gfp_mask, nodemask_t *nodemask,
-                       enum migrate_mode mode, int *contended,
-                       int alloc_flags, int classzone_idx)
+unsigned long try_to_compact_pages(gfp_t gfp_mask, unsigned int order,
+                       int alloc_flags, const struct alloc_context *ac,
+                       enum migrate_mode mode, int *contended)
 {
-       enum zone_type high_zoneidx = gfp_zone(gfp_mask);
        int may_enter_fs = gfp_mask & __GFP_FS;
        int may_perform_io = gfp_mask & __GFP_IO;
        struct zoneref *z;
@@ -1365,8 +1363,8 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist,
                return COMPACT_SKIPPED;
 
        /* Compact each zone in the list */
-       for_each_zone_zonelist_nodemask(zone, z, zonelist, high_zoneidx,
-                                                               nodemask) {
+       for_each_zone_zonelist_nodemask(zone, z, ac->zonelist, ac->high_zoneidx,
+                                                               ac->nodemask) {
                int status;
                int zone_contended;
 
@@ -1374,7 +1372,8 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist,
                        continue;
 
                status = compact_zone_order(zone, order, gfp_mask, mode,
-                               &zone_contended, alloc_flags, classzone_idx);
+                               &zone_contended, alloc_flags,
+                               ac->classzone_idx);
                rc = max(status, rc);
                /*
                 * It takes at least one zone that wasn't lock contended
@@ -1384,7 +1383,7 @@ unsigned long try_to_compact_pages(struct zonelist *zonelist,
 
                /* If a normal allocation would succeed, stop compacting */
                if (zone_watermark_ok(zone, order, low_wmark_pages(zone),
-                                       classzone_idx, alloc_flags)) {
+                                       ac->classzone_idx, alloc_flags)) {
                        /*
                         * We think the allocation will succeed in this zone,
                         * but it is not certain, hence the false. The caller