From patchwork Tue Jan 10 13:36:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 41475 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:4e01:0:0:0:0:0 with SMTP id p1csp2753486wrt; Tue, 10 Jan 2023 05:44:12 -0800 (PST) X-Google-Smtp-Source: AMrXdXsguF/bR/rwhQmQpRsjQgoAGvdS9TmLz98UromeoG4/N/CdnWm01nklbak38YcsNHzGCmld X-Received: by 2002:aa7:da0c:0:b0:499:b5a0:fe0c with SMTP id r12-20020aa7da0c000000b00499b5a0fe0cmr6331623eds.36.1673358251661; Tue, 10 Jan 2023 05:44:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673358251; cv=none; d=google.com; s=arc-20160816; b=s2b8QfJvtmwcYC93saKgpSYIfVwhjgxDouzmhZuNotoxewxkHURjNboAlJmkl3iNG2 5qFWh+eQbpMsWWYp0SFpfwpekw76vKOo8Ky+L8dr64u3UxIkHBXJqr4yR4gIdcfSwH/R jvYUjGEaRTPG24RjPJbIHG6wJZmiC69yyGchCthcvEHnXlWS2Gr0N5hZ1imYUsoCErqv tBZdyARSAA9ZELagxP8HTZC9ZbL1cPrziLIUgfo0Empt2rmtxaRN1CQuMaulemrb/ke/ TEDhaDgYajURR4gyCcaUXXXuPqyuVlDTKjjQEFo1ug/BYiOj4chk+VWoXpJSdCltTwoF jtQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=R9gg3StsoPQY3OtUR1oMOtD83gEFvGWsX8gEYE4vlx8=; b=NXP3WkeN7CDQOz5BrYdceycWf6F/ZFQMw2ULwP4cHTjzlwLLyT0V2hw+XEx2OgV6PR 7mJHzUIlMpcSSGvG+SB165rPcCQWC2L+2PVsCt46mT3eWuqalsMybJ7CzkUAx7zae2bo dA7hs1W+l2HzUJi/fVj7bcnAnp9MmJPgsulhsM1yIz8eB6EquQP308JpouWxRsc48oCj VBM+nYCMcT/mWm5p+v+8BLKqDh+yWnuymek+ZJIpXa867vi9d+XBoFvUcgaZRowhNbrn u5X7davEZ/hcHdTkfqbySsSLaX1E7rfiBz91A007KkE34VnrLW1kCXdn2RO89muHDEaT yMXA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x2-20020a05640225c200b0048d63df54d7si11507139edb.20.2023.01.10.05.43.47; Tue, 10 Jan 2023 05:44:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238725AbjAJNg5 (ORCPT + 99 others); Tue, 10 Jan 2023 08:36:57 -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 X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1754643302041125713?= X-GMAIL-MSGID: =?utf-8?q?1754643302041125713?= 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 capture_control *capc) trace_mm_compaction_end(cc, start_pfn, end_pfn, sync, ret); + VM_BUG_ON(!list_empty(&cc->freepages)); + VM_BUG_ON(!list_empty(&cc->migratepages)); + return ret; } @@ -2526,9 +2529,6 @@ static enum compact_result compact_zone_order(struct zone *zone, int order, ret = compact_zone(&cc, &capc); - 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 = zone; compact_zone(&cc, NULL); - - VM_BUG_ON(!list_empty(&cc.freepages)); - VM_BUG_ON(!list_empty(&cc.migratepages)); } } @@ -2689,9 +2686,6 @@ static void compact_node(int nid) cc.zone = zone; compact_zone(&cc, NULL); - - VM_BUG_ON(!list_empty(&cc.freepages)); - VM_BUG_ON(!list_empty(&cc.migratepages)); } } @@ -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)); } /*