From nobody Mon Sep 15 21:18:51 2025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DC37C678D5 for ; Tue, 10 Jan 2023 13:37:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238727AbjAJNg6 (ORCPT ); Tue, 10 Jan 2023 08:36:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233543AbjAJNgg (ORCPT ); Tue, 10 Jan 2023 08:36:36 -0500 Received: from out30-8.freemail.mail.aliyun.com (out30-8.freemail.mail.aliyun.com [115.124.30.8]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CD1EDBC8 for ; Tue, 10 Jan 2023 05:36:33 -0800 (PST) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R501e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046049;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VZJUhj7_1673357788; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VZJUhj7_1673357788) by smtp.aliyun-inc.com; Tue, 10 Jan 2023 21:36:28 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/5] mm: compaction: Move list validation into compact_zone() Date: Tue, 10 Jan 2023 21:36:19 +0800 Message-Id: <15cf54f7d762e87b04ac3cc74536f7d1ebbcd8cd.1673342761.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Move the cc.freepages and cc.migratepages list validation into compact_zone= () to remove some duplicate code. Signed-off-by: Baolin Wang --- mm/compaction.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 5e6f5e35748d..f8e8addc8664 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2488,6 +2488,9 @@ compact_zone(struct compact_control *cc, struct captu= re_control *capc) =20 trace_mm_compaction_end(cc, start_pfn, end_pfn, sync, ret); =20 + VM_BUG_ON(!list_empty(&cc->freepages)); + VM_BUG_ON(!list_empty(&cc->migratepages)); + return ret; } =20 @@ -2526,9 +2529,6 @@ static enum compact_result compact_zone_order(struct = zone *zone, int order, =20 ret =3D compact_zone(&cc, &capc); =20 - VM_BUG_ON(!list_empty(&cc.freepages)); - VM_BUG_ON(!list_empty(&cc.migratepages)); - /* * Make sure we hide capture control first before we read the captured * page pointer, otherwise an interrupt could free and capture a page @@ -2659,9 +2659,6 @@ static void proactive_compact_node(pg_data_t *pgdat) cc.zone =3D zone; =20 compact_zone(&cc, NULL); - - VM_BUG_ON(!list_empty(&cc.freepages)); - VM_BUG_ON(!list_empty(&cc.migratepages)); } } =20 @@ -2689,9 +2686,6 @@ static void compact_node(int nid) cc.zone =3D zone; =20 compact_zone(&cc, NULL); - - VM_BUG_ON(!list_empty(&cc.freepages)); - VM_BUG_ON(!list_empty(&cc.migratepages)); } } =20 @@ -2868,9 +2862,6 @@ static void kcompactd_do_work(pg_data_t *pgdat) cc.total_migrate_scanned); count_compact_events(KCOMPACTD_FREE_SCANNED, cc.total_free_scanned); - - VM_BUG_ON(!list_empty(&cc.freepages)); - VM_BUG_ON(!list_empty(&cc.migratepages)); } =20 /* --=20 2.27.0