From patchwork Thu May 25 12:53:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Baolin Wang X-Patchwork-Id: 13255184 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 4FF00C77B7A for ; Thu, 25 May 2023 12:54:28 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4352C280003; Thu, 25 May 2023 08:54:22 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 395AC280002; Thu, 25 May 2023 08:54:22 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 25E58280003; Thu, 25 May 2023 08:54:22 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 1104F280002 for ; Thu, 25 May 2023 08:54:22 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id D33131C7AA7 for ; Thu, 25 May 2023 12:54:21 +0000 (UTC) X-FDA: 80828770722.01.B24A36E Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) by imf15.hostedemail.com (Postfix) with ESMTP id 0B503A0016 for ; Thu, 25 May 2023 12:54:17 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1685019259; a=rsa-sha256; cv=none; b=KNW0rUcLoTHizjberozmTsZGNwjaNtdQnKJ/cM96tJ0IabBTjSHTmU7hM9VBbkEOsVngWd zo/3edEEstWThbCG2gJ8QC3tf4mV7fd0UDPlW90faRflFarHKHNEmB9abp2T/Rvz28DFTn mwG9RiTZry/mhYdVV/UVCMmY2kp+P1A= ARC-Authentication-Results: i=1; imf15.hostedemail.com; dkim=none; spf=pass (imf15.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.99 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com; dmarc=pass (policy=none) header.from=alibaba.com ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1685019259; 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=9PEP4Qe0owgriL+os+ebwHktoCpGXaTA8NLjInkUkIw=; b=iSQmQr+uXtRsRwJrPFIWmG84zEF8Dh3+6gr/XC6TzM1yUY+FupFqk2EW8YXbX6UEfWhPd+ F92xFHfc9l4LulolRz7v++4wGKV14NaePJynQxVf4HBOL1OAIKlpMzN68Ygf1ME9QPZW3z Sqi0IFy8tMaU7n13dXwz5d0hFKM7k18= X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R861e4;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=6;SR=0;TI=SMTPD_---0VjSJ3gf_1685019253; Received: from localhost(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VjSJ3gf_1685019253) by smtp.aliyun-inc.com; Thu, 25 May 2023 20:54:14 +0800 From: Baolin Wang To: akpm@linux-foundation.org Cc: mgorman@techsingularity.net, vbabka@suse.cz, baolin.wang@linux.alibaba.com, linux-mm@kvack.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/6] mm: compaction: skip more fully scanned pageblock Date: Thu, 25 May 2023 20:53:58 +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: rspam06 X-Rspamd-Queue-Id: 0B503A0016 X-Stat-Signature: aj3yjftc7nx3bker18e83em3aihouahi X-HE-Tag: 1685019257-269038 X-HE-Meta: U2FsdGVkX18FAunQUcNQF51cdn73YqFJ0EgDCIOc2hfna2fP/xZekQ3wzQCn+WWCvozlhg212/EQYkKzloN5a7hFU9lI46bnsu8B01ioC3EGV9m0ZK4u3MgbDwKcZGve6jnmZxkSvXYTMDAwHx74v//t0l0C5fApZbdBaYGGqHcr+XaTI3M+cxsABO8Q0k5jKOtbKjxc+bpBxgMubcqLh7xlgI71hui1KAOQFM7PHgDYCSrgzkieMVgyDpHN3MlBqIGES49FDiZqZYndxIvtrqAXFEyq3H8SN5Pe9SiqelEqGmVTCCikwNIP8e1Y9/MF4bwDQcNR8yotul1AXx94HPpwivfVcPK2y205kibI5zSFtyI6Gj390SctLoA9579Y3d99DXQEFAH6mO0220Pw7DfgTLKZzy4dIHIGQcBwD2z0NpMCe0xMgh7DYS/dtt1Ie4MgmDpqXmePIZzxL4j3iP6Ljb7SKIXU7EM8B8srTM3374wjlEdhEBQ2GuMwLGzSHOGXwEZS/560gwSd070QK3FXbzozbGwo44k44ANAOAuXXlMP419saXIuc2InRjsEeTMXXpxLmlHZy1E+9l0LtHZ07+119tMZGP02uSAK++wZUd9XLPj5mmOYbaFR5bq8ZZpoKpuqwRpdxpWYk+HhlJYX0Scft6DYbWYTNOp+DR9AhgTYD1Jgq7WCFExD1/6McufFWp9HfbK9lQ6FlGVF/4fYDxSSer1vZIVllbNEQZ0bHhfb5dUlPi8BXk4/Hsh7fUECdYVzmZZx2Q4aOtenfJeXyTCXcBqwnI2z7ala1zYjgrbcWHqMBxcDYw3HN2A5w0L2nNQ5W4oElBy1tQnF0Hi3DBmdgLatrgpJkNiuhZHN/E/UAQcC/G8nfEDrhFxMCTyDLR38wV9mW6BP48lxpcwGS0ZIc8Ya/pXcWPAtpwacTViKdbykfssMt58rZWQ1bBvMr3zcIKQjtM6hr4M E2Y27Mgq Ox3iqSH8yO8v2+YLho4oWQabBbwk6/jkGFhNUbF6r7lqjwdHU3bTHT52tFsbWxl+Dh7RJsUhb9OGUKpUeCg7t2SALFA== 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: In fast_isolate_around(), it assumes the pageblock is fully scanned if cc->nr_freepages < cc->nr_migratepages after trying to isolate some free pages, and will set skip flag to avoid scanning in future. However this can miss setting the skip flag for a fully scanned pageblock (returned 'start_pfn' is equal to 'end_pfn') in the case where cc->nr_freepages is larger than cc->nr_migratepages. So using the returned 'start_pfn' from isolate_freepages_block() and 'end_pfn' to decide if a pageblock is fully scanned makes more sense. It can also cover the case where cc->nr_freepages < cc->nr_migratepages, which means the 'start_pfn' is usually equal to 'end_pfn' except some uncommon fatal error occurs after non-strict mode isolation. Signed-off-by: Baolin Wang Acked-by: Vlastimil Babka --- mm/compaction.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mm/compaction.c b/mm/compaction.c index 3737c6591bfb..1e5183f39ca9 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -1411,7 +1411,7 @@ fast_isolate_around(struct compact_control *cc, unsigned long pfn) isolate_freepages_block(cc, &start_pfn, end_pfn, &cc->freepages, 1, false); /* Skip this pageblock in the future as it's full or nearly full */ - if (cc->nr_freepages < cc->nr_migratepages) + if (start_pfn == end_pfn) set_pageblock_skip(page); return;