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 AEA18C001DF for ; Wed, 2 Aug 2023 11:09:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 3D1FD280151; Wed, 2 Aug 2023 07:09:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 382FF280143; Wed, 2 Aug 2023 07:09:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 271BC280151; Wed, 2 Aug 2023 07:09:59 -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 18098280143 for ; Wed, 2 Aug 2023 07:09:59 -0400 (EDT) Received: from smtpin09.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id D613BB21C7 for ; Wed, 2 Aug 2023 11:09:58 +0000 (UTC) X-FDA: 81078894876.09.651D840 Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) by imf28.hostedemail.com (Postfix) with ESMTP id E1285C001C for ; Wed, 2 Aug 2023 11:09:55 +0000 (UTC) Authentication-Results: imf28.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf28.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.118 as permitted sender) smtp.mailfrom=baolin.wang@linux.alibaba.com ARC-Seal: i=1; s=arc-20220608; d=hostedemail.com; t=1690974597; a=rsa-sha256; cv=none; b=ofw8AVb72NQyQ0r6gLf/Wb4BEQbSWr/qZF86pp6s8xbU2c9sAQ0JA3XdJo8CL+8m127Y5V kBAw+GGhXlOOFkwGsg73vXVI8ghnTvzYye1I3PgfAS1z13Xq8vBpzBlgmAZYjw0emJHa3s 87Q5fh/t6D9dyMU5Ah++KXRp/dw6e6w= ARC-Authentication-Results: i=1; imf28.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf28.hostedemail.com: domain of baolin.wang@linux.alibaba.com designates 115.124.30.118 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=1690974597; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=bV/sUOgj9WVIIs14tif+yMnKUk00DIf+HEdEWgWK8tQ=; b=40iOXTplnvOZDfoSjnQOinE7b21xvvQUzEf+kCoZCeB0OlLCwa4dWlYRtbN+p/6zXgDCj5 eXPAm23ENJZo3KGmpnuZ6k7dVUusGnbqw4ixdv0GKnsz572uMk5Lzo1Pm/6JGgqxkfNDSi 2u0+soB54hIyxvXsTQXBuD1esAxMsL4= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R151e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0Vout75S_1690974590; Received: from 30.97.48.77(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0Vout75S_1690974590) by smtp.aliyun-inc.com; Wed, 02 Aug 2023 19:09:51 +0800 Message-ID: <58c4cef1-ebba-6aa9-bdef-19470f7d2ce8@linux.alibaba.com> Date: Wed, 2 Aug 2023 19:10:18 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.13.0 Subject: Re: [PATCH v2 1/8] mm/compaction: avoid missing last page block in section after skip offline sections To: Kemeng Shi , linux-mm@kvack.org, linux-kernel@vger.kernel.org, akpm@linux-foundation.org, mgorman@techsingularity.net, david@redhat.com References: <20230802093741.2333325-1-shikemeng@huaweicloud.com> <20230802093741.2333325-2-shikemeng@huaweicloud.com> From: Baolin Wang In-Reply-To: <20230802093741.2333325-2-shikemeng@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspamd-Server: rspam08 X-Rspamd-Queue-Id: E1285C001C X-Stat-Signature: dpxnd4k1wunb35tdmqsewsnq4kzj9fg6 X-Rspam-User: X-HE-Tag: 1690974595-830507 X-HE-Meta: U2FsdGVkX18Qm5nw4zALPe7ZEcSa1mFtVs83bsVxtOR4wac25CI8csPkEYgS/vLU2+CqCVBoYSLC89zuEW+pT/aq3CjDcB60mcPcIHQUKNephVcESvJEIvx1z20HBE76W3nfBQUq/BispE4xvufL6GGEgUIAsts6/z6YccXhvt75aYpIiAs2rboEmPx1HwocytJqVGiSDVkBN3a2sLivxf6c1j96tu+0tujd5ZQF1/877fWhH8su2jwgtnval/RZlrsm3bursgFa03D4DOEeH2O3QKyl2vtuE8vCpq6Ck6VwDzHxsCX5xLGLV7BL1TbzmqgljaJjzDMaKNORvsivfZ3qJMd/BZGd5ZTrZf324Zui6Vqlt4Pgv2g6KgUw1zYWSugd7v0K6nv+f/an5Zi1rSOa1PSJ2kT1V8WIYXhCZ9AmY4CSumnICDgzVuhU7MoyiGCvPv9/eH4WXMkOHBxkDNNQn5pblNxDPEyqCKcBw1RMR98HfZM5zmeJ34zQqs1d257wmlNnqZrciSX1WjAp8qHga7ppFNmnJaiFnk26mjh8UmJfI6qgrSO7QlSfEFQmmUNwQm+BcXeYqBZsd8biZhDkOFR+WYeKr+TCnSAGuvPWjkur6QUB5zUoM7O3apavKRLYKni8sh5xiBdWGyMxLS0yReaVxwpb17ykDW8VUoIGeeBfMKoEdNzPb6CZ4KJ7hy9raqt6IpkdeLzy23V3CjiXvOPhlL8O08GhaxziaV8nNJ0PG9Phn+ObNvbKNefcJu8DM27uLeUnJkZoE63pggo2XPD3X2+PpxZgpCoNlTA3fOFzopj6W01tOHS8gppyxysc8il76imcrN3yqiPQ6/gvN8IOmvx20c3JjOxsXNhDrgXAVL3Dls69fwc0olmze+BPe3sWTMawqTqyXMVXYKObu3JJy6OuZY2wfFAQX+FWfudAi+dGdGCGKmTQC6X1fuboZeL4YVFNkIGiOIS 188ZEnwr wCRyNLjWBtWy4iFpbzoMmumAlGO00z0sPkgkrhbmuB57edHIKHmAcvHWsxVUk4YSKQugTs8VbNH0+61MIJ1/iH4mbWC5HvsOHDsYx5gRXKL3P62ZWxyaqj0rv+xOqCDjaK/iod0ST3bGoecE= 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 8/2/2023 5:37 PM, Kemeng Shi wrote: > skip_offline_sections_reverse will return the last pfn in found online > section. Then we set block_start_pfn to start of page block which > contains the last pfn in section. Then we continue, move one page > block forward and ignore the last page block in the online section. > Make block_start_pfn point to first page block after online section to fix > this: > 1. make skip_offline_sections_reverse return end pfn of online section, > i.e. pfn of page block after online section. > 2. assign block_start_pfn with next_pfn. > > Fixes: f63224525309 ("mm: compaction: skip the memory hole rapidly when isolating free pages") The changes look good to me. But the commit id is not stable, since it is not merged into mm-stable branch yet. Not sure how to handle this patch, squash it into the original patch? Andrew, what do you prefer? > Signed-off-by: Kemeng Shi > --- > mm/compaction.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/mm/compaction.c b/mm/compaction.c > index cd23da4d2a5b..a8cea916df9d 100644 > --- a/mm/compaction.c > +++ b/mm/compaction.c > @@ -250,6 +250,11 @@ static unsigned long skip_offline_sections(unsigned long start_pfn) > return 0; > } > > +/* > + * If the PFN falls into an offline section, return the end PFN of the > + * next online section in reverse. If the PFN falls into an online section > + * or if there is no next online section in reverse, return 0. > + */ > static unsigned long skip_offline_sections_reverse(unsigned long start_pfn) > { > unsigned long start_nr = pfn_to_section_nr(start_pfn); > @@ -259,7 +264,7 @@ static unsigned long skip_offline_sections_reverse(unsigned long start_pfn) > > while (start_nr-- > 0) { > if (online_section_nr(start_nr)) > - return section_nr_to_pfn(start_nr) + PAGES_PER_SECTION - 1; > + return section_nr_to_pfn(start_nr) + PAGES_PER_SECTION; > } > > return 0; > @@ -1668,8 +1673,7 @@ static void isolate_freepages(struct compact_control *cc) > > next_pfn = skip_offline_sections_reverse(block_start_pfn); > if (next_pfn) > - block_start_pfn = max(pageblock_start_pfn(next_pfn), > - low_pfn); > + block_start_pfn = max(next_pfn, low_pfn); > > continue; > }