From: Baolin Wang <baolin.wang@linux.alibaba.com>
To: Kemeng Shi <shikemeng@huaweicloud.com>,
linux-mm@kvack.org, linux-kernel@vger.kernel.org,
akpm@linux-foundation.org, mgorman@techsingularity.net,
david@redhat.com, willy@infradead.org
Subject: Re: [PATCH v2 3/7] mm/compaction: correctly return failure with bogus compound_order in strict mode
Date: Tue, 29 Aug 2023 11:27:43 +0800 [thread overview]
Message-ID: <c243c9f4-51c9-797a-6ac2-b87d1689da14@linux.alibaba.com> (raw)
In-Reply-To: <20230826153617.4019189-4-shikemeng@huaweicloud.com>
On 8/26/2023 11:36 PM, Kemeng Shi wrote:
> In strict mode, we should return 0 if there is any hole in pageblock. If
> we successfully isolated pages at beginning at pageblock and then have a
> bogus compound_order outside pageblock in next page. We will abort search
> loop with blockpfn > end_pfn. Although we will limit blockpfn to end_pfn,
> we will treat it as a successful isolation in strict mode as blockpfn is
> not < end_pfn and return partial isolated pages. Then
> isolate_freepages_range may success unexpectly with hole in isolated
> range.
>
> Fixes: 9fcd6d2e052ee ("mm, compaction: skip compound pages by order in free scanner")
> Signed-off-by: Kemeng Shi <shikemeng@huaweicloud.com>
LGTM.
Reviewed-by: Baolin Wang <baolin.wang@linux.alibaba.com>
> ---
> mm/compaction.c | 11 +++++++++--
> 1 file changed, 9 insertions(+), 2 deletions(-)
>
> diff --git a/mm/compaction.c b/mm/compaction.c
> index a40550a33aee..b4d03c9ffe7c 100644
> --- a/mm/compaction.c
> +++ b/mm/compaction.c
> @@ -631,6 +631,14 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
> page += (1UL << order) - 1;
> nr_scanned += (1UL << order) - 1;
> }
> + /*
> + * There is a tiny chance that we have read bogus
> + * compound_order(), so be careful to not go outside
> + * of the pageblock.
> + */
> + if (unlikely(blockpfn >= end_pfn))
> + blockpfn = end_pfn - 1;
> +
> goto isolate_fail;
> }
>
> @@ -678,8 +686,7 @@ static unsigned long isolate_freepages_block(struct compact_control *cc,
> spin_unlock_irqrestore(&cc->zone->lock, flags);
>
> /*
> - * There is a tiny chance that we have read bogus compound_order(),
> - * so be careful to not go outside of the pageblock.
> + * Be careful to not go outside of the pageblock.
> */
> if (unlikely(blockpfn > end_pfn))
> blockpfn = end_pfn;
next prev parent reply other threads:[~2023-08-29 3:27 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-26 15:36 [PATCH v2 0/7] Fixes and cleanups to compaction Kemeng Shi
2023-08-26 15:36 ` [PATCH v2 1/7] mm/compaction: use correct list in move_freelist_{head}/{tail} Kemeng Shi
2023-08-29 9:03 ` Mel Gorman
2023-08-26 15:36 ` [PATCH v2 2/7] mm/compaction: call list_is_{first}/{last} more intuitively " Kemeng Shi
2023-08-29 9:18 ` Mel Gorman
2023-08-26 15:36 ` [PATCH v2 7/7] mm/compaction: factor out code to test if we should run compaction for target order Kemeng Shi
2023-08-29 3:48 ` Baolin Wang
2023-08-30 6:28 ` Kemeng Shi
2023-08-29 3:54 ` Matthew Wilcox
2023-08-30 6:45 ` Kemeng Shi
[not found] ` <20230826153617.4019189-4-shikemeng@huaweicloud.com>
2023-08-29 3:27 ` Baolin Wang [this message]
2023-08-29 9:39 ` [PATCH v2 3/7] mm/compaction: correctly return failure with bogus compound_order in strict mode Mel Gorman
2023-08-30 6:50 ` Kemeng Shi
[not found] ` <20230826153617.4019189-5-shikemeng@huaweicloud.com>
2023-08-29 15:01 ` [PATCH v2 4/7] mm/compaction: simplify pfn iteration in isolate_freepages_range Mel Gorman
2023-08-30 7:02 ` Kemeng Shi
[not found] ` <20230826153617.4019189-6-shikemeng@huaweicloud.com>
2023-08-29 15:05 ` [PATCH v2 5/7] mm/compaction: remove repeat compact_blockskip_flush check in reset_isolation_suitable Mel Gorman
2023-08-30 7:07 ` Kemeng Shi
[not found] ` <20230826153617.4019189-7-shikemeng@huaweicloud.com>
2023-08-29 3:28 ` [PATCH v2 6/7] mm/compaction: improve comment of is_via_compact_memory Baolin Wang
2023-08-29 15:06 ` Mel Gorman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c243c9f4-51c9-797a-6ac2-b87d1689da14@linux.alibaba.com \
--to=baolin.wang@linux.alibaba.com \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=mgorman@techsingularity.net \
--cc=shikemeng@huaweicloud.com \
--cc=willy@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox