All of lore.kernel.org
 help / color / mirror / Atom feed
From: Oscar Salvador <osalvador@suse.de>
To: Mike Rapoport <rppt@kernel.org>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	linux-arm-kernel@lists.infradead.org, linux-kernel@vger.org
Subject: Re: [PATCH] mm/memory_hotplug: Drop memblock_phys_free() call in try_remove_memory()
Date: Mon, 10 Jun 2024 06:56:15 +0200	[thread overview]
Message-ID: <ZmaHbzIT8yWR_g5d@localhost.localdomain> (raw)
In-Reply-To: <20240605082049.973242-1-rppt@kernel.org>

On Wed, Jun 05, 2024 at 11:20:49AM +0300, Mike Rapoport wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> The call for memblock_phys_free() in try_remove_memory() does not balance
> any call to memblock_alloc() (or memblock_reserve() for that matter).
> 
> There are no memblock_reserve() calls in mm/memory_hotplug.c, no memblock
> allocations possible after mm_core_init(), and even if memblock_add_node()
> called from add_memory_resource() would need to allocate memory, that
> memory would ba allocated from slab.
> 
> The patch f9126ab9241f ("memory-hotplug: fix wrong edge when hot add a new
> node") that introduced that call to memblock_free() does not provide
> adequate description why that was required and tinkering with memblock in
> the context of memory hotplug on x86 seems bogus because x86 never kept
> memblock after boot anyway.
> 
> Drop memblock_phys_free() call in try_remove_memory().
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> [rppt: rewrite the commit message]
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>

Acked-by: Oscar Salvador <osalvador@suse.de>

> ---
>  mm/memory_hotplug.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 431b1f6753c0..e0d49f128e0d 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -2283,10 +2283,8 @@ static int __ref try_remove_memory(u64 start, u64 size)
>  		remove_memory_blocks_and_altmaps(start, size);
>  	}
>  
> -	if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) {
> -		memblock_phys_free(start, size);
> +	if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK))
>  		memblock_remove(start, size);
> -	}
>  
>  	release_mem_region_adjustable(start, size);
>  
> -- 
> 2.43.0
> 

-- 
Oscar Salvador
SUSE Labs

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

WARNING: multiple messages have this Message-ID (diff)
From: Oscar Salvador <osalvador@suse.de>
To: Mike Rapoport <rppt@kernel.org>
Cc: linux-mm@kvack.org, Andrew Morton <akpm@linux-foundation.org>,
	David Hildenbrand <david@redhat.com>,
	Jonathan Cameron <Jonathan.Cameron@huawei.com>,
	linux-arm-kernel@lists.infradead.org, linux-kernel@vger.org
Subject: Re: [PATCH] mm/memory_hotplug: Drop memblock_phys_free() call in try_remove_memory()
Date: Mon, 10 Jun 2024 06:56:15 +0200	[thread overview]
Message-ID: <ZmaHbzIT8yWR_g5d@localhost.localdomain> (raw)
In-Reply-To: <20240605082049.973242-1-rppt@kernel.org>

On Wed, Jun 05, 2024 at 11:20:49AM +0300, Mike Rapoport wrote:
> From: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> 
> The call for memblock_phys_free() in try_remove_memory() does not balance
> any call to memblock_alloc() (or memblock_reserve() for that matter).
> 
> There are no memblock_reserve() calls in mm/memory_hotplug.c, no memblock
> allocations possible after mm_core_init(), and even if memblock_add_node()
> called from add_memory_resource() would need to allocate memory, that
> memory would ba allocated from slab.
> 
> The patch f9126ab9241f ("memory-hotplug: fix wrong edge when hot add a new
> node") that introduced that call to memblock_free() does not provide
> adequate description why that was required and tinkering with memblock in
> the context of memory hotplug on x86 seems bogus because x86 never kept
> memblock after boot anyway.
> 
> Drop memblock_phys_free() call in try_remove_memory().
> 
> Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
> [rppt: rewrite the commit message]
> Signed-off-by: Mike Rapoport (IBM) <rppt@kernel.org>

Acked-by: Oscar Salvador <osalvador@suse.de>

> ---
>  mm/memory_hotplug.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 431b1f6753c0..e0d49f128e0d 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -2283,10 +2283,8 @@ static int __ref try_remove_memory(u64 start, u64 size)
>  		remove_memory_blocks_and_altmaps(start, size);
>  	}
>  
> -	if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK)) {
> -		memblock_phys_free(start, size);
> +	if (IS_ENABLED(CONFIG_ARCH_KEEP_MEMBLOCK))
>  		memblock_remove(start, size);
> -	}
>  
>  	release_mem_region_adjustable(start, size);
>  
> -- 
> 2.43.0
> 

-- 
Oscar Salvador
SUSE Labs


  parent reply	other threads:[~2024-06-10  4:56 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-05  8:20 [PATCH] mm/memory_hotplug: Drop memblock_phys_free() call in try_remove_memory() Mike Rapoport
2024-06-05  8:20 ` Mike Rapoport
2024-06-05 13:29 ` David Hildenbrand
2024-06-07  7:37 ` Oscar Salvador
2024-06-07  7:37   ` Oscar Salvador
2024-06-10  4:56 ` Oscar Salvador [this message]
2024-06-10  4:56   ` Oscar Salvador

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=ZmaHbzIT8yWR_g5d@localhost.localdomain \
    --to=osalvador@suse.de \
    --cc=Jonathan.Cameron@huawei.com \
    --cc=akpm@linux-foundation.org \
    --cc=david@redhat.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.org \
    --cc=linux-mm@kvack.org \
    --cc=rppt@kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.