diff mbox series

[v2,1/2] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn

Message ID 20240524011914.27854-1-richard.weiyang@gmail.com (mailing list archive)
State New
Headers show
Series [v2,1/2] mm/mm_init.c: use memblock_region_memory_base_pfn() to get startpfn | expand

Commit Message

Wei Yang May 24, 2024, 1:19 a.m. UTC
Just like what it does in "if (mirrored_kernelcore)", we should use
memblock_region_memory_base_pfn() to get the startpfn.

Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
---
 include/linux/memblock.h | 2 +-
 mm/mm_init.c             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Comments

Mike Rapoport May 24, 2024, 8:16 a.m. UTC | #1
On Fri, May 24, 2024 at 01:19:13AM +0000, Wei Yang wrote:
> Just like what it does in "if (mirrored_kernelcore)", we should use
> memblock_region_memory_base_pfn() to get the startpfn.
> 
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---
>  include/linux/memblock.h | 2 +-
>  mm/mm_init.c             | 2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
> index e2082240586d..6cf18dc2b4d0 100644
> --- a/include/linux/memblock.h
> +++ b/include/linux/memblock.h
> @@ -565,7 +565,7 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
>  }
>  
>  /**
> - * for_each_mem_region - itereate over memory regions
> + * for_each_mem_region - iterate over memory regions

Sorry I've missed this in v1, but it should be a separate patch

>   * @region: loop variable
>   */
>  #define for_each_mem_region(region)					\
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index f72b852bd5b8..2dfb87841fdb 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -363,7 +363,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
>  
>  			nid = memblock_get_region_node(r);
>  
> -			usable_startpfn = PFN_DOWN(r->base);
> +			usable_startpfn = memblock_region_memory_base_pfn(r);
>  			zone_movable_pfn[nid] = zone_movable_pfn[nid] ?
>  				min(usable_startpfn, zone_movable_pfn[nid]) :
>  				usable_startpfn;
> -- 
> 2.34.1
>
Wei Yang May 25, 2024, 2:23 a.m. UTC | #2
On Fri, May 24, 2024 at 11:16:37AM +0300, Mike Rapoport wrote:
>On Fri, May 24, 2024 at 01:19:13AM +0000, Wei Yang wrote:
>> Just like what it does in "if (mirrored_kernelcore)", we should use
>> memblock_region_memory_base_pfn() to get the startpfn.
>> 
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> ---
>>  include/linux/memblock.h | 2 +-
>>  mm/mm_init.c             | 2 +-
>>  2 files changed, 2 insertions(+), 2 deletions(-)
>> 
>> diff --git a/include/linux/memblock.h b/include/linux/memblock.h
>> index e2082240586d..6cf18dc2b4d0 100644
>> --- a/include/linux/memblock.h
>> +++ b/include/linux/memblock.h
>> @@ -565,7 +565,7 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
>>  }
>>  
>>  /**
>> - * for_each_mem_region - itereate over memory regions
>> + * for_each_mem_region - iterate over memory regions
>
>Sorry I've missed this in v1, but it should be a separate patch

Sure, will separate it.
diff mbox series

Patch

diff --git a/include/linux/memblock.h b/include/linux/memblock.h
index e2082240586d..6cf18dc2b4d0 100644
--- a/include/linux/memblock.h
+++ b/include/linux/memblock.h
@@ -565,7 +565,7 @@  static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo
 }
 
 /**
- * for_each_mem_region - itereate over memory regions
+ * for_each_mem_region - iterate over memory regions
  * @region: loop variable
  */
 #define for_each_mem_region(region)					\
diff --git a/mm/mm_init.c b/mm/mm_init.c
index f72b852bd5b8..2dfb87841fdb 100644
--- a/mm/mm_init.c
+++ b/mm/mm_init.c
@@ -363,7 +363,7 @@  static void __init find_zone_movable_pfns_for_nodes(void)
 
 			nid = memblock_get_region_node(r);
 
-			usable_startpfn = PFN_DOWN(r->base);
+			usable_startpfn = memblock_region_memory_base_pfn(r);
 			zone_movable_pfn[nid] = zone_movable_pfn[nid] ?
 				min(usable_startpfn, zone_movable_pfn[nid]) :
 				usable_startpfn;