[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20210526071948.GA30891@linux>
Date: Wed, 26 May 2021 09:20:19 +0200
From: Oscar Salvador <osalvador@...e.de>
To: David Hildenbrand <david@...hat.com>
Cc: "Qian Cai (QUIC)" <quic_qiancai@...cinc.com>,
Andrew Morton <akpm@...ux-foundation.org>,
Anshuman Khandual <anshuman.khandual@....com>,
Vlastimil Babka <vbabka@...e.cz>,
Michal Hocko <mhocko@...nel.org>,
Linux Memory Management List <linux-mm@...ck.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>
Subject: Re: Arm64 crash while online/offline memory sections
On Tue, May 25, 2021 at 08:12:22PM +0200, David Hildenbrand wrote:
> diff --git a/drivers/base/memory.c b/drivers/base/memory.c
> index b31b3af5c490..6e661d106e96 100644
> --- a/drivers/base/memory.c
> +++ b/drivers/base/memory.c
> @@ -218,14 +218,15 @@ static int memory_block_offline(struct memory_block *mem)
> struct zone *zone;
> int ret;
> - zone = page_zone(pfn_to_page(start_pfn));
> -
> /*
> * Unaccount before offlining, such that unpopulated zone and kthreads
> * can properly be torn down in offline_pages().
> */
> - if (nr_vmemmap_pages)
> + if (nr_vmemmap_pages) {
> + /* Hotplugged memory has no holes. */
> + zone = page_zone(pfn_to_page(start_pfn));
> adjust_present_page_count(zone, -nr_vmemmap_pages);
> + }
> ret = offline_pages(start_pfn + nr_vmemmap_pages,
> nr_pages - nr_vmemmap_pages);
>
>
> We must not touch pfn_to_page(start_pfn) if it might be a memory hole.
> offline_pages() will make sure there are no holes, but that's too late.
Yeah, definitely. I somehow didn't think about holes when writing that.
Thanks for catching it David. Would you be so kind to send a patch?
Thanks!
--
Oscar Salvador
SUSE L3
Powered by blists - more mailing lists