[PATCH 9/9] mm/compaction: call compaction_suit_allocation_order in kcompactd_do_work

From: Kemeng Shi
Date: Fri Aug 04 2023 - 23:07:50 EST


Use compaction_suit_allocation_order helper in kcompactd_do_work to remove
repeat code.

Signed-off-by: Kemeng Shi <shikemeng@xxxxxxxxxxxxxxx>
---
mm/compaction.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/mm/compaction.c b/mm/compaction.c
index f4b6c520038a..05c27a1ef68a 100644
--- a/mm/compaction.c
+++ b/mm/compaction.c
@@ -2963,12 +2963,8 @@ static void kcompactd_do_work(pg_data_t *pgdat)
if (compaction_deferred(zone, cc.order))
continue;

- /* Allocation can already succeed, nothing to do */
- if (zone_watermark_ok(zone, cc.order,
- min_wmark_pages(zone), zoneid, 0))
- continue;
-
- if (!compaction_suitable(zone, cc.order, zoneid))
+ if (compaction_suit_allocation_order(zone,
+ cc.order, zoneid, 0) != COMPACT_CONTINUE)
continue;

if (kthread_should_stop())
--
2.30.0