From: Matthew Wilcox <willy@infradead.org>
To: Kefeng Wang <wangkefeng.wang@huawei.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
David Hildenbrand <david@redhat.com>,
Oscar Salvador <osalvador@suse.de>, Zi Yan <ziy@nvidia.com>,
linux-mm@kvack.org
Subject: Re: [PATCH RFC] mm: skip gigantic pages in isolate_single_pageblock() when mem offline
Date: Tue, 13 Aug 2024 15:03:57 +0100 [thread overview]
Message-ID: <ZrtnzUq7I4grXi6j@casper.infradead.org> (raw)
In-Reply-To: <20240813125226.1478800-1-wangkefeng.wang@huawei.com>
On Tue, Aug 13, 2024 at 08:52:26PM +0800, Kefeng Wang wrote:
> The gigantic page size may larger than memory block size, so memory
> offline always fails in this case after commit b2c9e2fbba32 ("mm: make
> alloc_contig_range work at pageblock granularity"),
>
> offline_pages
> start_isolate_page_range
> start_isolate_page_range(isolate_before=true)
> isolate [isolate_start, isolate_start + pageblock_nr_pages)
> start_isolate_page_range(isolate_before=false)
> isolate [isolate_end - pageblock_nr_pages, isolate_end) pageblock
> __alloc_contig_migrate_range
> isolate_migratepages_range
> isolate_migratepages_block
> isolate_or_dissolve_huge_page
> if (hstate_is_gigantic(h))
> return -ENOMEM;
>
> [ 15.815756] memory offlining [mem 0x3c0000000-0x3c7ffffff] failed due to failure to isolate range
>
> Fix it by skipping the __alloc_contig_migrate_range() if met gigantic
> pages when memory offline, which return back to the original logic to
> handle the gigantic pages.
This seems like the wrong way to fix this. The logic in the next
PageHuge() section seems like it's specifically supposed to handle
gigantic pages. So you've just made that dead code, but instead of
removing it, you've left it there to confuse everyone?
I admit to not understanding this code terribly well.
> Fixes: b2c9e2fbba32 ("mm: make alloc_contig_range work at pageblock granularity")
> Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
> ---
> mm/page_isolation.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/mm/page_isolation.c b/mm/page_isolation.c
> index 042937d5abe4..25db4040e70a 100644
> --- a/mm/page_isolation.c
> +++ b/mm/page_isolation.c
> @@ -400,6 +400,16 @@ static int isolate_single_pageblock(unsigned long boundary_pfn, int flags,
> continue;
> }
>
> + if ((flags & MEMORY_OFFLINE) && PageHuge(page)) {
> + struct hstate *h;
> +
> + h = size_to_hstate(nr_pages << PAGE_SHIFT);
> + if (hstate_is_gigantic(h)) {
> + pfn = head_pfn + nr_pages;
> + continue;
> + }
> + }
> +
> #if defined CONFIG_COMPACTION || defined CONFIG_CMA
> if (PageHuge(page)) {
> int page_mt = get_pageblock_migratetype(page);
> --
> 2.27.0
>
>
next prev parent reply other threads:[~2024-08-13 14:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-13 12:52 Kefeng Wang
2024-08-13 14:03 ` Matthew Wilcox [this message]
2024-08-13 14:46 ` Kefeng Wang
2024-08-13 14:59 ` Zi Yan
2024-08-14 2:01 ` Kefeng Wang
2024-08-14 14:53 ` Zi Yan
2024-08-15 2:58 ` Kefeng Wang
2024-08-15 16:43 ` Zi Yan
2024-08-16 0:56 ` Kefeng Wang
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=ZrtnzUq7I4grXi6j@casper.infradead.org \
--to=willy@infradead.org \
--cc=akpm@linux-foundation.org \
--cc=david@redhat.com \
--cc=linux-mm@kvack.org \
--cc=osalvador@suse.de \
--cc=wangkefeng.wang@huawei.com \
--cc=ziy@nvidia.com \
/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