From patchwork Tue Jan 10 13:36:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13095164 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 1F218C46467 for ; Tue, 10 Jan 2023 13:36:35 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4FD828E0003; Tue, 10 Jan 2023 08:36:35 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 4ADC88E0001; 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 3C4F38E0003; Tue, 10 Jan 2023 08:36:35 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 295A08E0001 for ; Tue, 10 Jan 2023 08:36:35 -0500 (EST) Received: from smtpin08.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id EF54312051F for ; Tue, 10 Jan 2023 13:36:34 +0000 (UTC) X-FDA: 80338989108.08.AE5ED97 Received: from out30-8.freemail.mail.aliyun.com (out30-8.freemail.mail.aliyun.com [115.124.30.8]) by imf02.hostedemail.com (Postfix) with ESMTP id 1EA1080013 for ; Tue, 10 Jan 2023 13:36:31 +0000 (UTC) Authentication-Results: imf02.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf02.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.8 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=79EipwoUGWr7Dt7aei0D+jzzxgqlEkuV8Uc+tPdrsQM=; b=R2qo3AlAOf1a7zV0/j4R6gAEqr03V0nMYIPIrLAg/41s3GuSYNyunLY5hvXCm22RmTgJy3 DqyUT0oS0alVpw3EsQd60UN5M5pwi9wtWvzuqe4fAisqqx6mVHpmdcGnzyi5cC1JLcDfRa wpD+Nf1vwWUWkWONB2Tsc7ghCpSRihY= ARC-Authentication-Results: i=1; imf02.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf02.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.8 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=Ftd0SVnmnInfhZC3fAnXXsQM7dtu+cnlg9IY+Z6VWtyLx92Czs3uOm8Hi9EpZNllUftvcj 8+JxbQBWH+hOWolkhchtLRQE0P2EW4EYpHDpBhQfFfMZx7Deq8zemmsNgVwUSlrnjQ5Uva F+s2etXuONL1l9IiRZajl//y7WK5x54= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045176;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VZJNeww_1673357787; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VZJNeww_1673357787) by smtp.aliyun-inc.com; Tue, 10 Jan 2023 21:36:27 +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 1/5] mm: compaction: Remove redundant VM_BUG_ON() in compact_zone() Date: Tue, 10 Jan 2023 21:36:18 +0800 Message-Id: <740a2396d9b98154dba76e326cba5e798b640ead.1673342761.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 1EA1080013 X-Stat-Signature: qce454het8mm1gjp8mbc7d1yt6j3k5ao X-HE-Tag: 1673357791-420306 X-HE-Meta: U2FsdGVkX1+VadUWuGHmdT8IR72BUxTcJpefO37CzsLvZzeLunb1N5QgqC08o1E0/2oADvISioy/Y2Rk34SLzbdeIxPA0fhQouuQSud8KxyO4zYtU68lYW71QOmgOY1uLfzi7Qwwj1N5ACmQ2xBngsG2dJ/5xXqp4sWxgGkBEZQt3taT5hWJoeqJuvWxX3owzjQ08NxSuloy0JwEzDMel5+R5wljviplMbckqCR5dUGIHLlP3VppulK1VLZHoPMSSmri0Oq//gebngAI7zBDs9GDOA/Z5orve7MiDPQNrUlzdCtw8P3rN5+A5kQvKLZKJNvTZNjfBYvFMW6UBQc50IFivSKaO8eyf9Ev8Qp5cC0bY1viVv2PpFo2lInrvZmpGgMcPFIdgUEaRVO74f8sYmnG2QyLmEwi2ar5RFUXbqaYsZ3W5zN+LuXl3fteki91R9KOJSsjbXs/3Sm1VY5FVS+32c6zqfDB5MBz2cz6BB+KtU3TXkW2yAIgWWkaF6yAKJjKgatJsFfaNG1uukf5WsekvNNB/O6O9TBWVneLSQXclEN77TdXc3ZOj7RsctbXhkdsJ88RAarrDeUJ0mSjCDVkMllGmsbjZmc4N/VDBIPvurwdmZFtTQKBUQORp+J+S4f2zfpI3uDif2quWuTXuu4CgjilOCgf9dl3/hWm+tNtHZqa427C9SeO6yb1CR2JuocwqAaKC+Y3e1Q5nse6Ms2QZnkW3mPUJLMOoxSUajfEVTGg6Qv5dYLwtNxYZG24/STJbk19ao/8fc94lCkXOcmtuyUrf08U6XRLz+JGcD78tfh+RgX5YIClIF7OHTYw8FhSUvJqqvX1RPdh2sZ4AfJ5b5ZeBNnzSwTGW54WJ0Ist+VsJtbizw== 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: The compaction_suitable() will never return values other than COMPACT_SUCCESS, COMPACT_SKIPPED and COMPACT_CONTINUE, so after validation of COMPACT_SUCCESS and COMPACT_SKIPPED, we will never hit other unexpected case. Thus remove the redundant VM_BUG_ON() validation for the return values of compaction_suitable(). Signed-off-by: Baolin Wang --- mm/compaction.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/mm/compaction.c b/mm/compaction.c index 62a61de44658..5e6f5e35748d 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2313,9 +2313,6 @@ compact_zone(struct compact_control *cc, struct capture_control *capc) if (ret == COMPACT_SUCCESS || ret == COMPACT_SKIPPED) return ret; - /* huh, compaction_suitable is returning something unexpected */ - VM_BUG_ON(ret != COMPACT_CONTINUE); - /* * Clear pageblock skip if there were failures recently and compaction * is about to be retried after being deferred. 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)); } /* From patchwork Tue Jan 10 13:36:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13095167 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 60AB2C54EBE for ; Tue, 10 Jan 2023 13:36:42 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 686098E0006; Tue, 10 Jan 2023 08:36:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 57A598E0009; Tue, 10 Jan 2023 08:36:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 1C82C8E0006; Tue, 10 Jan 2023 08:36:37 -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 066AC8E0007 for ; Tue, 10 Jan 2023 08:36:37 -0500 (EST) Received: from smtpin19.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id CE5FF80F73 for ; Tue, 10 Jan 2023 13:36:36 +0000 (UTC) X-FDA: 80338989192.19.08B307D Received: from out30-8.freemail.mail.aliyun.com (out30-8.freemail.mail.aliyun.com [115.124.30.8]) by imf29.hostedemail.com (Postfix) with ESMTP id DF5AF120010 for ; Tue, 10 Jan 2023 13:36:34 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf29.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.8 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673357795; a=rsa-sha256; cv=none; b=c9ZFoeURLcUoXbABZDTKrbAtyyV9/vgJpw4+GRPm8PxosNWl19iMmXx5JuD0L7XjeMZcjl 2AyNe+9PyGFf42XwKmiy+by/9jj5bK721acur2Bx/ER0QD3V6rP+bcoKF8hZtQQQPyE28O pdgEkklx+8qpGSRURB/KgGhyzQKI55o= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf29.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.8 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=1673357795; 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=hNGjI/01A2MPHFDvkldjhdG0u5k0DY1eIN4Z0OtkkoA=; b=aV9csFAMWfimhqvkeJVh016EEmwmwUhvq91faykkBHOnwD1Tmb7y7RD09ZyET6UOg9nxKt WMwYhC+Pwm1GV0PStlCftRicFdeS0aFylTT+QpJEzFmj/kEKxnRyOlI/JKnNQCNqoJgQ3z Er0oCzVNFL3jegSWF2LTM9ss8+SSOkM= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R291e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VZJNexH_1673357788; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VZJNexH_1673357788) by smtp.aliyun-inc.com; Tue, 10 Jan 2023 21:36:29 +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 3/5] mm: compaction: Count the migration scanned pages events for proactive compaction Date: Tue, 10 Jan 2023 21:36:20 +0800 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: DF5AF120010 X-Stat-Signature: waai5be96uynw96or59gy3nxpbjk37dj X-HE-Tag: 1673357794-752659 X-HE-Meta: U2FsdGVkX188lUf3qIn9iklnQlhA+yzo7M17Pisi9lGUm6JeWXbdKIF3RM0veUxvw1DhtaWGJoTb2odu3K+Md+q7Z8oaD0b+mWHYFDZPTk02mDxz+oASWTOS7xqefD5jg2Z1/nAG/Im1PMBPpGRAz4lXx5PvC06ZQXJkqogd0dycBjYvJDu96izpw++qVLGm/DZWwS5MwDnn/1cTuuETQ1WvH56QnsY06Mxzb4OaegG7Ix6M1gfC5+OdhvDP1fcfNNMJTumcUiV1SHALxAR3McubgM/VQZ9JaVY1bBYtcE2oKN+gPRi+HbPYyeciqaqtkCAfa9/2zoqwmF/U36lOVXv0OmQtJkIJm6AgnKa91l3B4E38r+z/1h2On9CflraL+Xx3JRqbXXv+yz01khWbAvAXmfAi0g8HAom1ackTtaiPXvGmHoT5aTg/ltFEEhyeU9J5G4M8UvSsf+tiUwTtj8KpkiJdsfOdhHGaTGJMnFl3YN49s423MhN1IKBp7uuHQHctv2dA5PJ0c/dZv116TqsvFWTQZM78MNuy4JBOkqvaF0MB6XrFNb56J/xOBSRXfWqQeyvhhMuQBmXcTwNk/31x8AJty9q0ZxJRC6QHTWTrKoCdHUtGJUYKKNU4lnQPPZZSlLhCLVs7voXc6SxMQN2IhvsF7Zodsqk6d/NVSJsQqjSJO8rf9bePMr88wite41HXFC3SuwPatw17qsScarsbALPBuU6782a9qMz+Ts6nWXywuWnVLr+Ka2vTRkb5YnhdYa7vt8/lWmZtrmyAKOXb2oLF0eDctObWBZG56+vrGPjNjs1wM3gWSDQQJiJgWHEC8pdA8Ro= 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: The proactive compaction will reuse per-node kcompactd threads, so we should also count the KCOMPACTD_MIGRATE_SCANNED and KCOMPACTD_FREE_SCANNED events for proactive compaction. Signed-off-by: Baolin Wang --- mm/compaction.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index f8e8addc8664..62f6bb68c9cb 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2659,6 +2659,11 @@ static void proactive_compact_node(pg_data_t *pgdat) cc.zone = zone; compact_zone(&cc, NULL); + + count_compact_events(KCOMPACTD_MIGRATE_SCANNED, + cc.total_migrate_scanned); + count_compact_events(KCOMPACTD_FREE_SCANNED, + cc.total_free_scanned); } } From patchwork Tue Jan 10 13:36:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13095168 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 CD681C63797 for ; Tue, 10 Jan 2023 13:36:43 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 5E86E8E0009; Tue, 10 Jan 2023 08:36:38 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 599A58E0007; Tue, 10 Jan 2023 08:36:38 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 460AB8E0009; Tue, 10 Jan 2023 08:36:38 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 2B3A58E0007 for ; Tue, 10 Jan 2023 08:36:38 -0500 (EST) Received: from smtpin04.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 02EF680DA4 for ; Tue, 10 Jan 2023 13:36:37 +0000 (UTC) X-FDA: 80338989276.04.69B0574 Received: from out199-6.us.a.mail.aliyun.com (out199-6.us.a.mail.aliyun.com [47.90.199.6]) by imf29.hostedemail.com (Postfix) with ESMTP id 21C72120003 for ; Tue, 10 Jan 2023 13:36:35 +0000 (UTC) Authentication-Results: imf29.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf29.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 47.90.199.6 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=1673357796; 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=aUqvJwZ3zTaTE2hwZW4/UAX21kQ42gjk8DtqU35VbJ4=; b=jwQ3ijqI836YDSRscNlpOR3Oh3qrpEdpGGASc/i4f/1L2wW8rswqi0UK236KCETvtOJqR1 pesSY7X8hOF+8TAVImYb0leW1+Q/MQK8+gOUkB96np7gwY6WhL5pFWexgOCC4ByeXTRRsX QF5D/lztdwSr2PVxemVD51Mjaa4jXX0= ARC-Authentication-Results: i=1; imf29.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf29.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 47.90.199.6 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673357796; a=rsa-sha256; cv=none; b=Q+/BIPDPP5CP+wbePIZVvoadVCC8Rnh2DBn6w6MEtLueOq+XBkRPikksipLy/pE4HOHnVf 3sZgqacxpvYh2Z9DX9XSEWTfeBOySqgswCV/F4yMpsU/6Zce/Fzcv1lqujCHNz35vDhH2a j7xHOMeARG7f/4Kzsy8qGzCuZRaFxic= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046050;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VZJNexU_1673357789; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VZJNexU_1673357789) by smtp.aliyun-inc.com; Tue, 10 Jan 2023 21:36:30 +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 4/5] mm: compaction: Add missing kcompactd wakeup trace event Date: Tue, 10 Jan 2023 21:36:21 +0800 Message-Id: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam02 X-Rspamd-Queue-Id: 21C72120003 X-Stat-Signature: 8nidy56iqhh1i3yddicow981im3d8ris X-HE-Tag: 1673357795-859257 X-HE-Meta: U2FsdGVkX18wQ3p7xu8ImFRibU3HNc+FD7N9pnZGAZ8j0cEwndBbqRFI9XMijszNpNDmhtYsNVv6utZDF/Vmzl3h8jK8ZPAqs++DxXUtHfp69NhfQcL0nvPgq4IAItbAz9oRDb3qseT0pQRQRGzvICUqgtAKPC6yD8cNm8cyPlpdzeEmuhzvpY7ZOxnlkHPQKT94UPn9EcIYZhZJkG4SbSnt9m/ARlH49EvS4BRQJRZ7+BHc5ZnoGQzJnRqWeNam0WCrv4/d+T6w/wuwBA+Sh+DlrsFJxtLg1eVhCr+dqsdaM0OCmQ45KaiYvoGlV4/BICT2XwSQLoe1Qbeua/ooGBfBtzmbRi86Uw0xTaEXi9udVEJtdp8rSvU2XbyOGhhGWdLmvmUEP9/c5aIq6HDqH8NNy9xP+nNRetelC212z1leIMsfVai8wv3UELQjXP9XNV8cuWnhDdHAWlf1dmocCVnDH+XzoPnLw7QDU0+f2k1HB4bUiK9fN8wZFVmjeuC5DOWiXyX9goOb3Bk3bqOGYUnkVCOkUFm/G1dA5zsL1TQ1etaVQW26dKmYd5FltzHRcX6vWxLFMkenExJUElxE3Sxl5R82tAIxV1ivY3eQHUrwAyx3hs9WK2+z0HmnkQkcKsrQGyNj5+fsA8zEgxt2vKp+HwTM321TtNRO9LFMQQdEnD45qUAQhI5Hl/v+XApIWV6+HPb7QjKmMJmYk+5lWQAauKNVWlkLxwW7+UX9rdZ26dxlgqqmg99H6623OThKL8TOyFG451b1EsaIFH2qeUblSliDSdg0fzUb3FF2g8WJxjI7NhDzkcMx4cTFed3s 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: Add missing kcompactd wakeup trace event for proactive compaction, meanwhile use order = -1 and the highest zone index of the pgdat for the kcompactd wakeup trace event by proactive compaction. Signed-off-by: Baolin Wang --- mm/compaction.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index 62f6bb68c9cb..0fd6c81a7809 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2730,6 +2730,8 @@ int compaction_proactiveness_sysctl_handler(struct ctl_table *table, int write, continue; pgdat->proactive_compact_trigger = true; + trace_mm_compaction_wakeup_kcompactd(pgdat->node_id, -1, + pgdat->nr_zones - 1); wake_up_interruptible(&pgdat->kcompactd_wait); } } From patchwork Tue Jan 10 13:36:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13095166 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 7AD81C54EBC for ; Tue, 10 Jan 2023 13:36:40 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 2DCFF8E0008; Tue, 10 Jan 2023 08:36:37 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 267048E0007; Tue, 10 Jan 2023 08:36:37 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 12CA38E0008; Tue, 10 Jan 2023 08:36:36 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id DF37B8E0006 for ; Tue, 10 Jan 2023 08:36:36 -0500 (EST) Received: from smtpin20.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id AA598AD456 for ; Tue, 10 Jan 2023 13:36:36 +0000 (UTC) X-FDA: 80338989192.20.BBFF070 Received: from out30-43.freemail.mail.aliyun.com (out30-43.freemail.mail.aliyun.com [115.124.30.43]) by imf24.hostedemail.com (Postfix) with ESMTP id BBE7C180012 for ; Tue, 10 Jan 2023 13:36:34 +0000 (UTC) Authentication-Results: imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf24.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.43 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1673357795; a=rsa-sha256; cv=none; b=mGydrfNX70j1eTQ8+s+jxt0AkFAhS9pVvkvO2dwVNiYiJ14p4/VvTn29++GHNcpmhHJuzD 7Iabb585snjVoqiKf1kmU7c5N4Br/uJm36K0lAmBoLlOV0FHSXqhut3le6fnK+xgR7BYj6 9l4GPWJAdzPDddslbqTjEDja8GUiA18= ARC-Authentication-Results: i=1; imf24.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf24.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.43 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=1673357795; 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=aUz5wuXddfVU8PbRGdBJ86wOUc4sRQaM/iFEVaa7T9s=; b=RGJt4hwC4UPZy077SW5xqZF1lSXMCWpGsDUiYNVD+AuCwQ2CGhsidfTi7BXVw2Znmilkcb HotW9CY3mGYYSkT63ea+S9tqTkoQuLKrpLhaQqOFe6i0A8LIh0x2P5D3ul7ozuEOEBBFfy fiRlxWmNbJ6Tswu5JprrAlEr9mVbYXI= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R181e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045192;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=4;SR=0;TI=SMTPD_---0VZJUhjw_1673357790; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VZJUhjw_1673357790) by smtp.aliyun-inc.com; Tue, 10 Jan 2023 21:36:30 +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 5/5] mm: compaction: Avoid fragmentation score calculation for empty zones Date: Tue, 10 Jan 2023 21:36:22 +0800 Message-Id: <100331ad9d274a9725e687b00d85d75d7e4a17c7.1673342761.git.baolin.wang@linux.alibaba.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: References: MIME-Version: 1.0 X-Rspam-User: X-Rspamd-Server: rspam03 X-Rspamd-Queue-Id: BBE7C180012 X-Stat-Signature: qxjon6jj135n4rr83go3eab37f7rnsci X-HE-Tag: 1673357794-212038 X-HE-Meta: U2FsdGVkX1+kULE/yG70kFjAeGim3Dgkchp7f1OA2S8U+tF5Eg4tvPiV3mbbIlHbn8rfzW4qxCcdu4+b2O2pMiDr3G/D2ZmF41ergHwdtHzgI9YKFIBEs2sOlGCp/PIhxIVYt6vvZyOB24GT4zbaumIJX/dKMeQ+CokGj8nVBuT5joIaHchfkP6oByfPe1IFiM7S6/0a1Dxku25FaAvte7wcCxOThQkTtdYrTc+9QwpEImATKBLEQdqrn/J7e7vztvYexKzUd/qSRNlo/MopDZVM18gA7DzZtkaRq9VtgJ+gMBG/bYkleQwCG1+Nsw/mPhpxCsTN0/CCac9Z2QX9c+M59K6t9v9MQ+NaS1JsDLx989svY/cnrfbHU1pALLzy2lJZZo5OaTOoZTbng5mwW7RhFUKk0DnrSfOZgQcDwGhvZkiIWKUCBVLanZhKmy5C6upPLgQLPFX0ulAyzvMzm6hcVJvUaBue18YwwsLff0o/xNwI4TfRcMkC+vGqGjhEyksk7mKXq5/Kr35LPFZMKfANZXvbBATpl+spX9PRT05cTjT4SGkVXxhJsVUWGfkU1gC2FqbFMMuyjFqZX/HoqeET0sh1ERB6cR+sXQpR+SGzFcMz7QpPrIRzDZxDa0aIt8ZWcAzxceN1aCuDZXyY1PUGCEO/FBMvS4OPUGclLWTxYpLGhrtV4oXO8S44zDP8VtpgcyG+Jwf005AJXz25ZpJnYjZdtU6b1fbdz30qNBru8AilFPN6rFezgQIc+IvxelHZvp+lniYssRHzOCf+leugqmS9gJ5rQfZQ2OkaYz+QwyU20qU9APCENrZUUoJfLhztkopXuAI= X-Bogosity: Ham, tests=bogofilter, spamicity=0.032285, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: There is no need to calculate the fragmentation score for empty zones. Signed-off-by: Baolin Wang --- mm/compaction.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/mm/compaction.c b/mm/compaction.c index 0fd6c81a7809..b758b00a4885 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -2025,6 +2025,8 @@ static unsigned int fragmentation_score_node(pg_data_t *pgdat) struct zone *zone; zone = &pgdat->node_zones[zoneid]; + if (!populated_zone(zone)) + continue; score += fragmentation_score_zone_weighted(zone); }