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: 13095163 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 kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id CEC84C54EBC for ; Tue, 10 Jan 2023 13:36:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id CA4A18E0005; Tue, 10 Jan 2023 08:36:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id C4EC48E0006; Tue, 10 Jan 2023 08:36:35 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AE1118E0001; Tue, 10 Jan 2023 08:36:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 9B8798E0001 for ; Tue, 10 Jan 2023 08:36:35 -0500 (EST) Received: from smtpin03.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 660E01C6DC4 for ; Tue, 10 Jan 2023 13:36:35 +0000 (UTC) X-FDA: 80338989150.03.4D23EC1 Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) by imf13.hostedemail.com (Postfix) with ESMTP id 77D0C20009 for ; Tue, 10 Jan 2023 13:36:32 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf13.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.57 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1673357793; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=R9gg3StsoPQY3OtUR1oMOtD83gEFvGWsX8gEYE4vlx8=; b=GxYWDlsw4YqR4skyoKsn7A5YzlmUPQ6u7bzkhREaX9KznK9xHjqRJXEH3D64eXYV3t/Z/c PS/0rbF8rrC675AsSXXdPacn/IOiZh3JsvtpDe9hON8KnpjKlvvpMPgAbW8D7OAOwcb8AE zBoQ30uRZ5RkhtkDl9ExLwdgV7Z1T5M= ARC-Authentication-Results: i=1; imf13.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf13.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.57 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673357793; a=rsa-sha256; cv=none; b=rnlmH6FTWQ/ZQj+53WLwA1iCqV/Sk7jZ0oTPUIqBGa3HUI/+lGWDv4hD4C9XKBnY/zBiBU 5ib3hfwmNbjBbH+J30a+k3kcskcg7S9H8tk16v/OiqDcUu33VEcu/3x0dSglQbSJIn3R3W zjVPpnjNg2umymdFM4enPO4sCrINbtU= 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-Rspamd-Queue-Id: 77D0C20009 X-Rspamd-Server: rspam09 X-Rspam-User: X-Stat-Signature: ss6pqnhynhx56m6oh7zyqewxwefmuj4t X-HE-Tag: 1673357792-112759 X-HE-Meta: U2FsdGVkX1/J8Hc1ZrfPfjmg4EiVrVAFRfGh6+GEdwrFc7cXrwdnjbufBfzGfzLRi73zaxRKsoOZl8eMitwWC+HpBhD0Y5T7ZXnhr25UMuthE3MOCCl31NzNOoBgbE598eHYFfcYCxsgKV1g3yN37GMa9rFee6Pdp7LAYMF7+v1fo+Nq5VGYqLZXfMUk1Q3+WBs8woASoQQkj8rG48r1C+r8ep0zw/FRA7gI4RYpF6/RJwjJdoi865KxtEi1ua0qMiy8d5aeTEIFpguY0P/T59aoVegmxHh5bt25Px7d/MlNxOhkFOIgkIKoa2mjy1OzE+gcqMzaClsl8mbXyBt4b3ZyxFjo4XDMcXt00ILQcX5tILbPcpzLdRXcdoCN2iRlTefNfs6xxMgEHS9Z0yINaxQkieM7zJi4E4Tzks8IY20ASQZTXfOJDKVq+MmO86liWy9wr4Zs3TXQA1PcYeKdG1N2zec49LHM9JAvBESQrn8KvZo1bTHl7O8sShnzf+1/Rey5VCgToQ0ch3MM7TmGI+fm/U/xhiKF5SANIjGYnh6gAyPtUwr+tTd6xV8WAMPzqsj1qAgNKC770ITvYH6nlANnXw/L+Sl1/vmwpHvghq0DdRhRde7ZKWkJlPBc2TUw0gKji98x9Ev6LRfB8MHfY5Tbkt/SYyyzYz3FklKPkZJW3yTRSEjUm1y8fuHl6fZKZ0N8U3hl0/VJ8g6ux9GONznoCGV9mVuzePkTjfoeCEDWg7/0UNjrj3KQ+ZKpmV7jaGSOrauGVYLdkj85uI9QgZOrt6NpR8IrBr9HDXp0g/RTyfcZwM7stDX4oxK9EIMOyCLJuuF2RpAtz4hET2WifWKr2Zlc20iGLeajXRsZ2UHnjP+r69C9oA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: 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)); } /*