From nobody Mon Feb 9 12:15:38 2026 Received: from mail-ot1-f51.google.com (mail-ot1-f51.google.com [209.85.210.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A644BF9F5 for ; Wed, 20 Mar 2024 02:42:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710902547; cv=none; b=XHOqP0huvLTKcAzgUuyjFod0i51YO71RUq4fSgo1JrMQzmuHQ3b/nvLlTXoJtx8vn3g1yMbGcGLcHjKZ1yNdQPXOS0ztJMwQl4j39bVM9zTTmvaYyydaM4Dmn51v6dknP1B5xrWcjMvU98/atwP2xcT0PeNNvX2xHQ5J/V2qDGo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1710902547; c=relaxed/simple; bh=l52JrmiqoXyGIuFFDgBlXrC/zh8TWuGP8g41ayonsYU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=qPHhUzG4y9+v7R0aXPuQkXSC1Jg3yr9Z6wq3uYK48klPWbIh19YLPGOR7Cu6UUN2qFYu7jBzaTaN2w6RlaCTTgm9WRdRtubEtXeWdVSWmcsNUyVjItz+GGfha08N9DGbV+53zNYpWlhZaWL4GeEAzwti+uarvEcOPfTINXg0oP4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cs.cmu.edu; spf=pass smtp.mailfrom=andrew.cmu.edu; dkim=pass (2048-bit key) header.d=cs.cmu.edu header.i=@cs.cmu.edu header.b=b26ysJaW; arc=none smtp.client-ip=209.85.210.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=cs.cmu.edu Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=andrew.cmu.edu Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=cs.cmu.edu header.i=@cs.cmu.edu header.b="b26ysJaW" Received: by mail-ot1-f51.google.com with SMTP id 46e09a7af769-6e6969855c8so1602626a34.0 for ; Tue, 19 Mar 2024 19:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.cmu.edu; s=google-2021; t=1710902542; x=1711507342; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=UljsMw4YXxvG2im1vY4a6XAU2ZaTJQdUEua3lUBpIog=; b=b26ysJaWaMFF1aefAi/9HdyoC665IxctzqD06rPgFth8PFOfayGvSVkUNd3BEyXVLv 8j+dRLDyKWXzkRO1SZuWmr6xDhoEp+8p5eNB4qyVYbLdYIFRk/DiOgGOCRq8xCBMqkTD 7mXnKZJOWYN48M8/ME8or95lUrtslfKAgVr1oHmFmiHwBLAY9reVwsUje1eTDs0PVTx3 TuV1CVy0kg3fXinS24JYVCg1LE+4xl2AE/29XCIP7iQQJNQ8pozlZNnhTm7DXC2TSxGo xbVOrxsnTBQ0SBuGLrG4tsQ55E+ktcbgpYvzOgxkYoXIGOt+lP+97+TjSjFbrRjOEcqD nsrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1710902542; x=1711507342; h=content-transfer-encoding:mime-version:reply-to:references :in-reply-to:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=UljsMw4YXxvG2im1vY4a6XAU2ZaTJQdUEua3lUBpIog=; b=c3h9iN0GweR7/L5Ke9/CJP2sDFiK6yGRlxsZbzTaIntoFl1f0q9wwOcnDCI+Pyl0pD vdajrmox/DZMAcF8YKs3Tut69+SG3Hx7AeJLY0CME9jajLlS0nzyDFmA1/kNAD6DMuPk yXVP2rZOJ22kiXmZMZ2RC/YEEHlq30/Q6eIRy9hfgUOLUzmqVlHIWPb5pIYsWsk/61Tv EjIlPp0Vvt2nBhlZoH8BAtOb2uWFdxrKx6MX0UI7fEvUwi2XbxTF6hWa2lf167geDygO sPSewBHewTH7mPK0Deozq0WF8TWpSYH/uvmtbSm9RZfsGpDEeHekTo48jxcU0NlF9x8Q 4rgQ== X-Forwarded-Encrypted: i=1; AJvYcCWgbdrlMntLKFwmp+Q/GVCoMtibJHDSHJ7BxUZ0rnnLc8DTmqpWGIBENF0xCrBoOakIlbxrR1Op51iWGnLO+fDUYSmLPukiBCYXKaho X-Gm-Message-State: AOJu0Yyxe0k63aKwlQ89sHnrtQ/lGJWBIYWwyijHMRwnde6K9Ii708/n CtU8wHrVKFtfeBXKGFKV3qvpQiHoyAvE+7huEl3A8qMK+ftSbdLL4yY44roCag== X-Google-Smtp-Source: AGHT+IESptNQKDLD8MOe2hQxpKnyZd4H1raJLsnnYtjWGvQGBbhnaHWmiZ6IFtzpyT4LI3UuB+xfsg== X-Received: by 2002:a9d:74c5:0:b0:6e4:f961:e444 with SMTP id a5-20020a9d74c5000000b006e4f961e444mr5504940otl.4.1710902542503; Tue, 19 Mar 2024 19:42:22 -0700 (PDT) Received: from localhost (pool-74-98-221-57.pitbpa.fios.verizon.net. [74.98.221.57]) by smtp.gmail.com with UTF8SMTPSA id y27-20020a05620a09db00b00789f0d9e6dcsm3560797qky.93.2024.03.19.19.42.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 19 Mar 2024 19:42:22 -0700 (PDT) From: kaiyang2@cs.cmu.edu To: linux-mm@kvack.org, linux-kernel@vger.kernel.org Cc: Kaiyang Zhao , hannes@cmpxchg.org, ziy@nvidia.com, dskarlat@cs.cmu.edu Subject: [RFC PATCH 3/7] compaction accepts a destination zone Date: Wed, 20 Mar 2024 02:42:14 +0000 Message-Id: <20240320024218.203491-4-kaiyang2@cs.cmu.edu> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240320024218.203491-1-kaiyang2@cs.cmu.edu> References: <20240320024218.203491-1-kaiyang2@cs.cmu.edu> Reply-To: Kaiyang Zhao Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Kaiyang Zhao Distinguishes the source and destination zones in compaction Signed-off-by: Kaiyang Zhao --- include/linux/compaction.h | 4 +- mm/compaction.c | 106 +++++++++++++++++++++++-------------- mm/internal.h | 1 + mm/vmscan.c | 4 +- 4 files changed, 70 insertions(+), 45 deletions(-) diff --git a/include/linux/compaction.h b/include/linux/compaction.h index a6e512cfb670..11f5a1a83abb 100644 --- a/include/linux/compaction.h +++ b/include/linux/compaction.h @@ -90,7 +90,7 @@ extern enum compact_result try_to_compact_pages(gfp_t gfp= _mask, struct page **page); extern void reset_isolation_suitable(pg_data_t *pgdat); extern enum compact_result compaction_suitable(struct zone *zone, int orde= r, - unsigned int alloc_flags, int highest_zoneidx); + unsigned int alloc_flags, int highest_zoneidx, struct zone *dst_zone); =20 extern void compaction_defer_reset(struct zone *zone, int order, bool alloc_success); @@ -180,7 +180,7 @@ static inline void reset_isolation_suitable(pg_data_t *= pgdat) } =20 static inline enum compact_result compaction_suitable(struct zone *zone, i= nt order, - int alloc_flags, int highest_zoneidx) + int alloc_flags, int highest_zoneidx, struct zone *dst_zone) { return COMPACT_SKIPPED; } diff --git a/mm/compaction.c b/mm/compaction.c index c8bcdea15f5f..03b5c4debc17 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -435,7 +435,7 @@ static void update_cached_migrate(struct compact_contro= l *cc, unsigned long pfn) static void update_pageblock_skip(struct compact_control *cc, struct page *page, unsigned long pfn) { - struct zone *zone =3D cc->zone; + struct zone *dst_zone =3D cc->dst_zone ? cc->dst_zone : cc->zone; =20 if (cc->no_set_skip_hint) return; @@ -446,8 +446,8 @@ static void update_pageblock_skip(struct compact_contro= l *cc, set_pageblock_skip(page); =20 /* Update where async and sync compaction should restart */ - if (pfn < zone->compact_cached_free_pfn) - zone->compact_cached_free_pfn =3D pfn; + if (pfn < dst_zone->compact_cached_free_pfn) + dst_zone->compact_cached_free_pfn =3D pfn; } #else static inline bool isolation_suitable(struct compact_control *cc, @@ -550,6 +550,7 @@ static unsigned long isolate_freepages_block(struct com= pact_control *cc, bool locked =3D false; unsigned long blockpfn =3D *start_pfn; unsigned int order; + struct zone *dst_zone =3D cc->dst_zone ? cc->dst_zone : cc->zone; =20 /* Strict mode is for isolation, speed is secondary */ if (strict) @@ -568,7 +569,7 @@ static unsigned long isolate_freepages_block(struct com= pact_control *cc, * pending. */ if (!(blockpfn % COMPACT_CLUSTER_MAX) - && compact_unlock_should_abort(&cc->zone->lock, flags, + && compact_unlock_should_abort(&dst_zone->lock, flags, &locked, cc)) break; =20 @@ -596,7 +597,7 @@ static unsigned long isolate_freepages_block(struct com= pact_control *cc, =20 /* If we already hold the lock, we can skip some rechecking. */ if (!locked) { - locked =3D compact_lock_irqsave(&cc->zone->lock, + locked =3D compact_lock_irqsave(&dst_zone->lock, &flags, cc); =20 /* Recheck this is a buddy page under lock */ @@ -634,7 +635,7 @@ static unsigned long isolate_freepages_block(struct com= pact_control *cc, } =20 if (locked) - spin_unlock_irqrestore(&cc->zone->lock, flags); + spin_unlock_irqrestore(&dst_zone->lock, flags); =20 /* * There is a tiny chance that we have read bogus compound_order(), @@ -683,11 +684,12 @@ isolate_freepages_range(struct compact_control *cc, { unsigned long isolated, pfn, block_start_pfn, block_end_pfn; LIST_HEAD(freelist); + struct zone *dst_zone =3D cc->dst_zone ? cc->dst_zone : cc->zone; =20 pfn =3D start_pfn; block_start_pfn =3D pageblock_start_pfn(pfn); - if (block_start_pfn < cc->zone->zone_start_pfn) - block_start_pfn =3D cc->zone->zone_start_pfn; + if (block_start_pfn < dst_zone->zone_start_pfn) + block_start_pfn =3D dst_zone->zone_start_pfn; block_end_pfn =3D pageblock_end_pfn(pfn); =20 for (; pfn < end_pfn; pfn +=3D isolated, @@ -710,7 +712,7 @@ isolate_freepages_range(struct compact_control *cc, } =20 if (!pageblock_pfn_to_page(block_start_pfn, - block_end_pfn, cc->zone)) + block_end_pfn, dst_zone)) break; =20 isolated =3D isolate_freepages_block(cc, &isolate_start_pfn, @@ -1359,6 +1361,7 @@ fast_isolate_around(struct compact_control *cc, unsig= ned long pfn) { unsigned long start_pfn, end_pfn; struct page *page; + struct zone *dst_zone =3D cc->dst_zone ? cc->dst_zone : cc->zone; =20 /* Do not search around if there are enough pages already */ if (cc->nr_freepages >=3D cc->nr_migratepages) @@ -1369,10 +1372,10 @@ fast_isolate_around(struct compact_control *cc, uns= igned long pfn) return; =20 /* Pageblock boundaries */ - start_pfn =3D max(pageblock_start_pfn(pfn), cc->zone->zone_start_pfn); - end_pfn =3D min(pageblock_end_pfn(pfn), zone_end_pfn(cc->zone)); + start_pfn =3D max(pageblock_start_pfn(pfn), dst_zone->zone_start_pfn); + end_pfn =3D min(pageblock_end_pfn(pfn), zone_end_pfn(dst_zone)); =20 - page =3D pageblock_pfn_to_page(start_pfn, end_pfn, cc->zone); + page =3D pageblock_pfn_to_page(start_pfn, end_pfn, dst_zone); if (!page) return; =20 @@ -1414,6 +1417,7 @@ fast_isolate_freepages(struct compact_control *cc) struct page *page =3D NULL; bool scan_start =3D false; int order; + struct zone *dst_zone =3D cc->dst_zone ? cc->dst_zone : cc->zone; =20 /* Full compaction passes in a negative order */ if (cc->order <=3D 0) @@ -1423,7 +1427,7 @@ fast_isolate_freepages(struct compact_control *cc) * If starting the scan, use a deeper search and use the highest * PFN found if a suitable one is not found. */ - if (cc->free_pfn >=3D cc->zone->compact_init_free_pfn) { + if (cc->free_pfn >=3D dst_zone->compact_init_free_pfn) { limit =3D pageblock_nr_pages >> 1; scan_start =3D true; } @@ -1448,7 +1452,7 @@ fast_isolate_freepages(struct compact_control *cc) for (order =3D cc->search_order; !page && order >=3D 0; order =3D next_search_order(cc, order)) { - struct free_area *area =3D &cc->zone->free_area[order]; + struct free_area *area =3D &dst_zone->free_area[order]; struct list_head *freelist; struct page *freepage; unsigned long flags; @@ -1458,7 +1462,7 @@ fast_isolate_freepages(struct compact_control *cc) if (!area->nr_free) continue; =20 - spin_lock_irqsave(&cc->zone->lock, flags); + spin_lock_irqsave(&dst_zone->lock, flags); freelist =3D &area->free_list[MIGRATE_MOVABLE]; list_for_each_entry_reverse(freepage, freelist, lru) { unsigned long pfn; @@ -1469,7 +1473,7 @@ fast_isolate_freepages(struct compact_control *cc) =20 if (pfn >=3D highest) highest =3D max(pageblock_start_pfn(pfn), - cc->zone->zone_start_pfn); + dst_zone->zone_start_pfn); =20 if (pfn >=3D low_pfn) { cc->fast_search_fail =3D 0; @@ -1516,7 +1520,7 @@ fast_isolate_freepages(struct compact_control *cc) } } =20 - spin_unlock_irqrestore(&cc->zone->lock, flags); + spin_unlock_irqrestore(&dst_zone->lock, flags); =20 /* * Smaller scan on next order so the total scan is related @@ -1541,17 +1545,17 @@ fast_isolate_freepages(struct compact_control *cc) if (cc->direct_compaction && pfn_valid(min_pfn)) { page =3D pageblock_pfn_to_page(min_pfn, min(pageblock_end_pfn(min_pfn), - zone_end_pfn(cc->zone)), - cc->zone); + zone_end_pfn(dst_zone)), + dst_zone); cc->free_pfn =3D min_pfn; } } } } =20 - if (highest && highest >=3D cc->zone->compact_cached_free_pfn) { + if (highest && highest >=3D dst_zone->compact_cached_free_pfn) { highest -=3D pageblock_nr_pages; - cc->zone->compact_cached_free_pfn =3D highest; + dst_zone->compact_cached_free_pfn =3D highest; } =20 cc->total_free_scanned +=3D nr_scanned; @@ -1569,7 +1573,7 @@ fast_isolate_freepages(struct compact_control *cc) */ static void isolate_freepages(struct compact_control *cc) { - struct zone *zone =3D cc->zone; + struct zone *zone =3D cc->dst_zone ? cc->dst_zone : cc->zone; struct page *page; unsigned long block_start_pfn; /* start of current pageblock */ unsigned long isolate_start_pfn; /* exact pfn we start at */ @@ -2089,11 +2093,19 @@ static enum compact_result __compact_finished(struc= t compact_control *cc) unsigned int order; const int migratetype =3D cc->migratetype; int ret; + struct zone *dst_zone =3D cc->dst_zone ? cc->dst_zone : cc->zone; =20 - /* Compaction run completes if the migrate and free scanner meet */ - if (compact_scanners_met(cc)) { + /* + * Compaction run completes if the migrate and free scanner meet + * or when either the src or dst zone has been completely scanned + */ + if (compact_scanners_met(cc) || + cc->migrate_pfn >=3D zone_end_pfn(cc->zone) || + cc->free_pfn < dst_zone->zone_start_pfn) { /* Let the next compaction start anew. */ reset_cached_positions(cc->zone); + if (cc->dst_zone) + reset_cached_positions(cc->dst_zone); =20 /* * Mark that the PG_migrate_skip information should be cleared @@ -2196,10 +2208,13 @@ static enum compact_result compact_finished(struct = compact_control *cc) static enum compact_result __compaction_suitable(struct zone *zone, int or= der, unsigned int alloc_flags, int highest_zoneidx, - unsigned long wmark_target) + unsigned long wmark_target, struct zone *dst_zone) { unsigned long watermark; =20 + if (!dst_zone) + dst_zone =3D zone; + if (is_via_compact_memory(order)) return COMPACT_CONTINUE; =20 @@ -2227,9 +2242,9 @@ static enum compact_result __compaction_suitable(stru= ct zone *zone, int order, * suitable migration targets */ watermark =3D (order > PAGE_ALLOC_COSTLY_ORDER) ? - low_wmark_pages(zone) : min_wmark_pages(zone); + low_wmark_pages(dst_zone) : min_wmark_pages(dst_zone); watermark +=3D compact_gap(order); - if (!__zone_watermark_ok(zone, 0, watermark, highest_zoneidx, + if (!__zone_watermark_ok(dst_zone, 0, watermark, highest_zoneidx, ALLOC_CMA, wmark_target)) return COMPACT_SKIPPED; =20 @@ -2245,13 +2260,16 @@ static enum compact_result __compaction_suitable(st= ruct zone *zone, int order, */ enum compact_result compaction_suitable(struct zone *zone, int order, unsigned int alloc_flags, - int highest_zoneidx) + int highest_zoneidx, struct zone *dst_zone) { enum compact_result ret; int fragindex; =20 + if (!dst_zone) + dst_zone =3D zone; + ret =3D __compaction_suitable(zone, order, alloc_flags, highest_zoneidx, - zone_page_state(zone, NR_FREE_PAGES)); + zone_page_state(dst_zone, NR_FREE_PAGES), dst_zone); /* * fragmentation index determines if allocation failures are due to * low memory or external fragmentation @@ -2305,7 +2323,7 @@ bool compaction_zonelist_suitable(struct alloc_contex= t *ac, int order, available =3D zone_reclaimable_pages(zone) / order; available +=3D zone_page_state_snapshot(zone, NR_FREE_PAGES); compact_result =3D __compaction_suitable(zone, order, alloc_flags, - ac->highest_zoneidx, available); + ac->highest_zoneidx, available, NULL); if (compact_result =3D=3D COMPACT_CONTINUE) return true; } @@ -2317,8 +2335,9 @@ static enum compact_result compact_zone(struct compact_control *cc, struct capture_control *capc) { enum compact_result ret; + struct zone *dst_zone =3D cc->dst_zone ? cc->dst_zone : cc->zone; unsigned long start_pfn =3D cc->zone->zone_start_pfn; - unsigned long end_pfn =3D zone_end_pfn(cc->zone); + unsigned long end_pfn =3D zone_end_pfn(dst_zone); unsigned long last_migrated_pfn; const bool sync =3D cc->mode !=3D MIGRATE_ASYNC; bool update_cached; @@ -2337,7 +2356,7 @@ compact_zone(struct compact_control *cc, struct captu= re_control *capc) =20 cc->migratetype =3D gfp_migratetype(cc->gfp_mask); ret =3D compaction_suitable(cc->zone, cc->order, cc->alloc_flags, - cc->highest_zoneidx); + cc->highest_zoneidx, dst_zone); /* Compaction is likely to fail */ if (ret =3D=3D COMPACT_SUCCESS || ret =3D=3D COMPACT_SKIPPED) return ret; @@ -2346,14 +2365,19 @@ compact_zone(struct compact_control *cc, struct cap= ture_control *capc) * Clear pageblock skip if there were failures recently and compaction * is about to be retried after being deferred. */ - if (compaction_restarting(cc->zone, cc->order)) + if (compaction_restarting(cc->zone, cc->order)) { __reset_isolation_suitable(cc->zone); + if (dst_zone !=3D cc->zone) + __reset_isolation_suitable(dst_zone); + } =20 /* * Setup to move all movable pages to the end of the zone. Used cached * information on where the scanners should start (unless we explicitly * want to compact the whole zone), but check that it is initialised * by ensuring the values are within zone boundaries. + * + * If a destination zone is provided, use it for free pages. */ cc->fast_start_pfn =3D 0; if (cc->whole_zone) { @@ -2361,12 +2385,12 @@ compact_zone(struct compact_control *cc, struct cap= ture_control *capc) cc->free_pfn =3D pageblock_start_pfn(end_pfn - 1); } else { cc->migrate_pfn =3D cc->zone->compact_cached_migrate_pfn[sync]; - cc->free_pfn =3D cc->zone->compact_cached_free_pfn; - if (cc->free_pfn < start_pfn || cc->free_pfn >=3D end_pfn) { + cc->free_pfn =3D dst_zone->compact_cached_free_pfn; + if (cc->free_pfn < dst_zone->zone_start_pfn || cc->free_pfn >=3D end_pfn= ) { cc->free_pfn =3D pageblock_start_pfn(end_pfn - 1); - cc->zone->compact_cached_free_pfn =3D cc->free_pfn; + dst_zone->compact_cached_free_pfn =3D cc->free_pfn; } - if (cc->migrate_pfn < start_pfn || cc->migrate_pfn >=3D end_pfn) { + if (cc->migrate_pfn < start_pfn || cc->migrate_pfn >=3D zone_end_pfn(cc-= >zone)) { cc->migrate_pfn =3D start_pfn; cc->zone->compact_cached_migrate_pfn[0] =3D cc->migrate_pfn; cc->zone->compact_cached_migrate_pfn[1] =3D cc->migrate_pfn; @@ -2522,8 +2546,8 @@ compact_zone(struct compact_control *cc, struct captu= re_control *capc) * Only go back, not forward. The cached pfn might have been * already reset to zone end in compact_finished() */ - if (free_pfn > cc->zone->compact_cached_free_pfn) - cc->zone->compact_cached_free_pfn =3D free_pfn; + if (free_pfn > dst_zone->compact_cached_free_pfn) + dst_zone->compact_cached_free_pfn =3D free_pfn; } =20 count_compact_events(COMPACTMIGRATE_SCANNED, cc->total_migrate_scanned); @@ -2834,7 +2858,7 @@ static bool kcompactd_node_suitable(pg_data_t *pgdat) continue; =20 if (compaction_suitable(zone, pgdat->kcompactd_max_order, 0, - highest_zoneidx) =3D=3D COMPACT_CONTINUE) + highest_zoneidx, NULL) =3D=3D COMPACT_CONTINUE) return true; } =20 @@ -2871,7 +2895,7 @@ static void kcompactd_do_work(pg_data_t *pgdat) if (compaction_deferred(zone, cc.order)) continue; =20 - if (compaction_suitable(zone, cc.order, 0, zoneid) !=3D + if (compaction_suitable(zone, cc.order, 0, zoneid, NULL) !=3D COMPACT_CONTINUE) continue; =20 diff --git a/mm/internal.h b/mm/internal.h index 68410c6d97ac..349223cc0359 100644 --- a/mm/internal.h +++ b/mm/internal.h @@ -465,6 +465,7 @@ struct compact_control { unsigned long migrate_pfn; unsigned long fast_start_pfn; /* a pfn to start linear scan from */ struct zone *zone; + struct zone *dst_zone; /* use another zone as the destination */ unsigned long total_migrate_scanned; unsigned long total_free_scanned; unsigned short fast_search_fail;/* failures to use free list searches */ diff --git a/mm/vmscan.c b/mm/vmscan.c index 5bf98d0a22c9..aa21da983804 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c @@ -6383,7 +6383,7 @@ static inline bool should_continue_reclaim(struct pgl= ist_data *pgdat, if (!managed_zone(zone)) continue; =20 - switch (compaction_suitable(zone, sc->order, 0, sc->reclaim_idx)) { + switch (compaction_suitable(zone, sc->order, 0, sc->reclaim_idx, NULL)) { case COMPACT_SUCCESS: case COMPACT_CONTINUE: return false; @@ -6580,7 +6580,7 @@ static inline bool compaction_ready(struct zone *zone= , struct scan_control *sc) unsigned long watermark; enum compact_result suitable; =20 - suitable =3D compaction_suitable(zone, sc->order, 0, sc->reclaim_idx); + suitable =3D compaction_suitable(zone, sc->order, 0, sc->reclaim_idx, NUL= L); if (suitable =3D=3D COMPACT_SUCCESS) /* Allocation should succeed already. Don't reclaim. */ return true; --=20 2.40.1