From mboxrd@z Thu Jan 1 00:00:00 1970 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 8FF92C433EF for ; Thu, 14 Jul 2022 12:01:47 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id B0176940134; Thu, 14 Jul 2022 08:01:46 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id AB1466B0102; Thu, 14 Jul 2022 08:01:46 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 9A1EC940134; Thu, 14 Jul 2022 08:01:46 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 88D4B6B0101 for ; Thu, 14 Jul 2022 08:01:46 -0400 (EDT) Received: from smtpin11.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay13.hostedemail.com (Postfix) with ESMTP id 541C761220 for ; Thu, 14 Jul 2022 12:01:46 +0000 (UTC) X-FDA: 79685566212.11.0BCFE55 Received: from outbound-smtp14.blacknight.com (outbound-smtp14.blacknight.com [46.22.139.231]) by imf22.hostedemail.com (Postfix) with ESMTP id 8BD20C0087 for ; Thu, 14 Jul 2022 12:01:36 +0000 (UTC) Received: from mail.blacknight.com (pemlinmail04.blacknight.ie [81.17.254.17]) by outbound-smtp14.blacknight.com (Postfix) with ESMTPS id D5C511C4B3E for ; Thu, 14 Jul 2022 13:01:34 +0100 (IST) Received: (qmail 4178 invoked from network); 14 Jul 2022 12:01:34 -0000 Received: from unknown (HELO techsingularity.net) (mgorman@techsingularity.net@[84.203.198.246]) by 81.17.254.9 with ESMTPSA (AES256-SHA encrypted, authenticated); 14 Jul 2022 12:01:34 -0000 Date: Thu, 14 Jul 2022 12:50:20 +0100 From: Mel Gorman To: Andrew Morton Cc: Chuyi Zhou , linux-mm@kvack.org Subject: Re: [PATCH v3] mm/compaction: fix set skip in fast_find_migrateblock Message-ID: <20220714115020.GA3563@techsingularity.net> References: <20220713062009.597255-1-zhouchuyi@bytedance.com> <20220713082814.bed234e00d7f5ceb3858352a@linux-foundation.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Disposition: inline In-Reply-To: <20220713082814.bed234e00d7f5ceb3858352a@linux-foundation.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Rspam-User: X-Stat-Signature: 5f5e8bc6zmaycrmn3zyxiqrgth14qrk4 X-Rspamd-Queue-Id: 8BD20C0087 Authentication-Results: imf22.hostedemail.com; dkim=none; spf=temperror (imf22.hostedemail.com: error in processing during lookup of mgorman@techsingularity.net: DNS error) smtp.mailfrom=mgorman@techsingularity.net X-Rspamd-Server: rspam03 X-HE-Tag: 1657800096-323992 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: On Wed, Jul 13, 2022 at 08:28:14AM -0700, Andrew Morton wrote: > (cc Mel) > > On Wed, 13 Jul 2022 14:20:09 +0800 Chuyi Zhou wrote: > > > From: zhouchuyi > > > > When we successfully find a pageblock in fast_find_migrateblock(), > > the block will be set skip-flag through set_pageblock_skip(). However, > > when entering isolate_migratepages_block(), the whole pageblock will > > be skipped due to the branch > > 'if (!valid_page && IS_ALIGNED(low_pfn, pageblock_nr_pages))'. > > Eventually we will goto isolate_abort and isolate nothing. That cause > > fast_find_migrateblock useless. > > It's not very clear *why* this failed from the changelog because superficially !valid_page will be true for the first pageblock and there is a reasonable expectation it will be aligned. Is the following accurate based on your analysis? However, when entering isolate_migratepages_block(), the first pageblock will be skipped in the branch 'if (!valid_page && IS_ALIGNED(low_pfn, pageblock_nr_pages))' as isolation_suitable returns true due to the skip bit set by fast_find_migrateblock(). If so, please update the changelog as a reviewer handling backports may wonder what exactly is wrong with that branch. Second, what guarantees a block returned by fast_find that is not aligned gets marked skipped after it is scanned? The set_pageblock_skip is only called when there is a valid page and it may not be set if !IS_ALIGNED(low_pfn). Is something like this untested hunk also necessary? diff --git a/mm/compaction.c b/mm/compaction.c index 1f89b969c12b..112346b2f716 100644 --- a/mm/compaction.c +++ b/mm/compaction.c @@ -888,8 +888,9 @@ isolate_migratepages_block(struct compact_control *cc, unsigned long low_pfn, * COMPACT_CLUSTER_MAX at a time so the second call must * not falsely conclude that the block should be skipped. */ - if (!valid_page && IS_ALIGNED(low_pfn, pageblock_nr_pages)) { - if (!isolation_suitable(cc, page)) { + if (!valid_page) { + if (IS_ALIGNED(low_pfn, pageblock_nr_pages) && + !isolation_suitable(cc, page)) { low_pfn = end_pfn; page = NULL; goto isolate_abort; > > In this Patch, when we find a suitable pageblock in fast_find_ > > migrateblock, we do noting but let isolate_migratepages_block > > to set skip flag to the pageblock after scan it. Normally, > > we would isolate some pages from the fast-find block. > > > > I use mmtest/thpscale-madvhugepage test it. Here is the result: > > baseline patch > > Amean fault-both-1 1331.66 ( 0.00%) 1261.04 * 5.30%* > > Amean fault-both-3 1383.95 ( 0.00%) 1191.69 * 13.89%* > > Amean fault-both-5 1568.13 ( 0.00%) 1445.20 * 7.84%* > > Amean fault-both-7 1819.62 ( 0.00%) 1555.13 * 14.54%* > > Amean fault-both-12 1106.96 ( 0.00%) 1149.43 * -3.84%* > > Amean fault-both-18 2196.93 ( 0.00%) 1875.77 * 14.62%* > > Amean fault-both-24 2642.69 ( 0.00%) 2671.21 * -1.08%* > > Amean fault-both-30 2901.89 ( 0.00%) 2857.32 * 1.54%* > > Amean fault-both-32 3747.00 ( 0.00%) 3479.23 * 7.15%* > > > > Fixes: 70b44595eafe9 ("mm, compaction: use free lists to quickly locate a migration source") > > > > Signed-off-by: zhouchuyi No need for a newline between Fixes and Signed-off-by. The Signed-off-by should have your full name, not a username. -- Mel Gorman SUSE Labs