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 EB20AEB64DD for ; Mon, 7 Aug 2023 09:41:23 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 6CF716B0072; Mon, 7 Aug 2023 05:41:23 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 67F306B0074; Mon, 7 Aug 2023 05:41:23 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 56DDF8D0002; Mon, 7 Aug 2023 05:41:23 -0400 (EDT) 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 4711B6B0072 for ; Mon, 7 Aug 2023 05:41:23 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1A9F2C09B6 for ; Mon, 7 Aug 2023 09:41:23 +0000 (UTC) X-FDA: 81096815646.30.C98F908 Received: from out30-118.freemail.mail.aliyun.com (out30-118.freemail.mail.aliyun.com [115.124.30.118]) by imf04.hostedemail.com (Postfix) with ESMTP id 0E32740014 for ; Mon, 7 Aug 2023 09:41:19 +0000 (UTC) Authentication-Results: imf04.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf04.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=1691401281; 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=WAkYMZ4obeVqtQ5hPpD/JZts8pyHiL4zdeAvfUn5N0I=; b=yATCIHjYGTs/WUJ8NTU0x/QJE4fE/J/1q+SfrH13WILkD6I8mOJ8EYnF2YtWq+tW/f3QWF IshL1sEIBM2SasDS2mWd3ZW1nkGhlY13XK4Yp0eDE3mwB99gEYzCTZWRUNUk/t+PXOUAQE bS4J5MGAe8xAjToFeN/ytNG+DrjCyyM= ARC-Authentication-Results: i=1; imf04.hostedemail.com; dkim=none; dmarc=pass (policy=none) header.from=alibaba.com; spf=pass (imf04.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=1691401281; a=rsa-sha256; cv=none; b=IAXy6TjE+b2C8r9x2Jt1rPIkd3m0vwzwQ8ciDyGGNDkEuwahuqNQdssxNccOBoi3mdk4Ct 6EA6yyyKL6Hr7XzacS70E/1P5QpMOkZZxmQRMYJ7GkMOvDfg73CjWE8zsKs6mdnM+FxX8I k+6r7qk8hz0VHvJUZgXggmgPAzhOIMk= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R461e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0VpDy-iw_1691401275; Received: from 30.97.48.53(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VpDy-iw_1691401275) by smtp.aliyun-inc.com; Mon, 07 Aug 2023 17:41:16 +0800 Message-ID: <38ecab02-f702-a1e8-29c2-102a439428f1@linux.alibaba.com> Date: Mon, 7 Aug 2023 17:41:17 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.14.0 Subject: Re: [PATCH v3 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: <20230804110454.2935878-1-shikemeng@huaweicloud.com> <20230804110454.2935878-2-shikemeng@huaweicloud.com> From: Baolin Wang In-Reply-To: <20230804110454.2935878-2-shikemeng@huaweicloud.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Rspam-User: X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 0E32740014 X-Stat-Signature: 9wkq9x691sm5u7cfkq1am6qd4ffatjf8 X-HE-Tag: 1691401279-748630 X-HE-Meta: U2FsdGVkX1+jI4B8bCJziooizj1QfgYx41pLyO41CNv+WEO3khTxh09zZjL5wb7P8i0OcMJiW9yMQko8NJLvaIoZGqy1ZNaqsjylYKdNZGoDQ61E5Z/IQKjoJED5itBrjKv4k3lX0j13lj4ymdN94Pf/zoBd/fMAUcfiRYB+pK438IyTCECKUcni8W8wLLMWCdk4EmQFZxdA3M03/hD6AEnsfTBdrx/wDIv5iE+rULfBsePjtpTNWfj8STyreXJYJT0d5XooyvEDW+1ndmFZNwKApOlci9ZTkFB41mctG6sPWgUq3gYLuAxqThuq4/6NluQinBD/lrN7VUL++PpcNi1pKO6rGFKzL1RLxaFOMK+O6qevQC8tDyDXG26IpsxfavPXRTVpK6b3U25RZaYqcvxY447AxFg1KS34PXscic+2O861G411N2YFrEUf+2bSvhqMUQX/zbze3c2QqzNSb9EnohOcuTNS+CHM9vevJIOjbVpnPp5GjWa470g1x1wgRzeHXx5tc0kJ5pNfamRfCJnd66hm094iZlJKzABqDQ8q/Rguy6pUx1xdMpuSLJr9+7JpgrLAaEKZrynGGTq2j7LjfIEjeqrM3J96ol6XmL1rwP1G10JmknpJNnNB1/VDzMwVA2kbeDdl1LNAPBwjsfR5xDd3pDs2WIAprggWV2YMZ/+WchPJR1Qu4EXLVcX+yhqNgZbhf0xv9JZD7H6dLlZtdxiDs2n73I0Ryq4tciCDX/CmnfbDJhl1Dw8XXV8nq7vPUBWY3xQo+bMdlYGB6NhTjE2OlHbov43bho+tIgJGD0ifNQnf7IJHsXcwtt7+5qKWAw/pB8Bpg6dqqr8jybsytxEncIqlwLev+gKuXz0LXEe6O8M4DDaElbRhRgBAJ1118S1NDRAS9ho/a+1AtPOBpkQ5EaAu0mi1qROpRbxtcXcjo+g/NEDLSnx7I8Y2ZJEaAOdRNtRlx621XE+ H9bYxt8h XW3ZrYokd/+hzdJWS4qKmbt+klwg3hH4BiaiUYsaldLN2WBCqt51NdEhHQ2UObD5EEmuLStJsUcb76dIaINdeB82T5pWIWJCTf+trNfHjmv4Nb9MAV3ygBTlWTQ+Z0FWvK+5ds3z93Mk85DZ4CU0knGP/b5vhCrU7DO2U 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/4/2023 7:04 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") Again, the Fixes tag is not stable. Please consider squashing it into the original commit or hold this patch until the original patch is merged into mm-stable branch. Andrew, What do you prefer? Thanks. > Signed-off-by: Kemeng Shi > Acked-by: David Hildenbrand > > --- > mm/compaction.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) > > diff --git a/mm/compaction.c b/mm/compaction.c > index 006fc35bffa1..a21b834c5898 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; > @@ -1690,8 +1695,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; > }