lkml.org 
[lkml]   [2021]   [May]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRE: Arm64 crash while online/offline memory sections
Date


> -----Original Message-----
> From: David Hildenbrand <david@redhat.com>
> Sent: Tuesday, May 25, 2021 2:12 PM
> I assume the following will work:
>
> 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.

Good catch, David. This patch works well.

\
 
 \ /
  Last update: 2021-05-25 21:57    [W:0.970 / U:1.584 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site