diff mbox series

ARM: mm: make use of new memblocks_present() helper

Message ID 20190319181357.9305-1-logang@deltatee.com (mailing list archive)
State New, archived
Headers show
Series ARM: mm: make use of new memblocks_present() helper | expand

Commit Message

Logan Gunthorpe March 19, 2019, 6:13 p.m. UTC
Cleanup the arm_memory_present() function seeing it's very
similar to other arches.

The new memblocks_present() helper checks for node ids which the
arm version did not. However, this is equivalent seeing
HAVE_MEMBLOCK_NODE_MAP should be false in this arch and therefore
memblock_get_region_node() should return 0.

Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
Cc: Russell King <linux@armlinux.org.uk>
Cc: Kees Cook <keescook@chromium.org>
Cc: Philip Derrin <philip@cog.systems>
Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mm/init.c | 17 +----------------
 1 file changed, 1 insertion(+), 16 deletions(-)

This is just a resend.

--
2.20.1

Comments

Mike Rapoport March 19, 2019, 8:42 p.m. UTC | #1
On Tue, Mar 19, 2019 at 12:13:57PM -0600, Logan Gunthorpe wrote:
> Cleanup the arm_memory_present() function seeing it's very
> similar to other arches.
> 
> The new memblocks_present() helper checks for node ids which the
> arm version did not. However, this is equivalent seeing
> HAVE_MEMBLOCK_NODE_MAP should be false in this arch and therefore
> memblock_get_region_node() should return 0.
> 
> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> Cc: Russell King <linux@armlinux.org.uk>
> Cc: Kees Cook <keescook@chromium.org>
> Cc: Philip Derrin <philip@cog.systems>
> Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> Cc: Nicolas Pitre <nicolas.pitre@linaro.org>

Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>

Strangely, I've got a feeling I've already reviewed such patch from a
different person...

> ---
>  arch/arm/mm/init.c | 17 +----------------
>  1 file changed, 1 insertion(+), 16 deletions(-)
> 
> This is just a resend.
> 
> diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
> index 478ea8b7db87..6c50dd407ba8 100644
> --- a/arch/arm/mm/init.c
> +++ b/arch/arm/mm/init.c
> @@ -182,21 +182,6 @@ int pfn_valid(unsigned long pfn)
>  EXPORT_SYMBOL(pfn_valid);
>  #endif
> 
> -#ifndef CONFIG_SPARSEMEM
> -static void __init arm_memory_present(void)
> -{
> -}
> -#else
> -static void __init arm_memory_present(void)
> -{
> -	struct memblock_region *reg;
> -
> -	for_each_memblock(memory, reg)
> -		memory_present(0, memblock_region_memory_base_pfn(reg),
> -			       memblock_region_memory_end_pfn(reg));
> -}
> -#endif
> -
>  static bool arm_memblock_steal_permitted = true;
> 
>  phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
> @@ -292,7 +277,7 @@ void __init bootmem_init(void)
>  	 * Sparsemem tries to allocate bootmem in memory_present(),
>  	 * so must be done after the fixed reservations
>  	 */
> -	arm_memory_present();
> +	memblocks_present();
> 
>  	/*
>  	 * sparse_init() needs the bootmem allocator up and running.
> --
> 2.20.1
>
Logan Gunthorpe March 19, 2019, 8:50 p.m. UTC | #2
On 2019-03-19 2:42 p.m., Mike Rapoport wrote:
> On Tue, Mar 19, 2019 at 12:13:57PM -0600, Logan Gunthorpe wrote:
>> Cleanup the arm_memory_present() function seeing it's very
>> similar to other arches.
>>
>> The new memblocks_present() helper checks for node ids which the
>> arm version did not. However, this is equivalent seeing
>> HAVE_MEMBLOCK_NODE_MAP should be false in this arch and therefore
>> memblock_get_region_node() should return 0.
>>
>> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
>> Cc: Russell King <linux@armlinux.org.uk>
>> Cc: Kees Cook <keescook@chromium.org>
>> Cc: Philip Derrin <philip@cog.systems>
>> Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
>> Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
> 
> Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
> 
> Strangely, I've got a feeling I've already reviewed such patch from a
> different person...

You're probably referring to [1] which was for arm64 and was redundant
as my patch for that architecture was already picked up by Catalin.

I was the person who originally introduced memblocks_present() and I'm
still hoping to get the cleanup patches for the arm and sh arches to be
picked up.

Thanks,

Logan

[1]
https://lore.kernel.org/lkml/20190210093738.30923-1-peng.fan@nxp.com/T/#u
Mike Rapoport March 19, 2019, 9:05 p.m. UTC | #3
On Tue, Mar 19, 2019 at 02:50:25PM -0600, Logan Gunthorpe wrote:
> 
> 
> On 2019-03-19 2:42 p.m., Mike Rapoport wrote:
> > On Tue, Mar 19, 2019 at 12:13:57PM -0600, Logan Gunthorpe wrote:
> >> Cleanup the arm_memory_present() function seeing it's very
> >> similar to other arches.
> >>
> >> The new memblocks_present() helper checks for node ids which the
> >> arm version did not. However, this is equivalent seeing
> >> HAVE_MEMBLOCK_NODE_MAP should be false in this arch and therefore
> >> memblock_get_region_node() should return 0.
> >>
> >> Signed-off-by: Logan Gunthorpe <logang@deltatee.com>
> >> Cc: Russell King <linux@armlinux.org.uk>
> >> Cc: Kees Cook <keescook@chromium.org>
> >> Cc: Philip Derrin <philip@cog.systems>
> >> Cc: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
> >> Cc: Nicolas Pitre <nicolas.pitre@linaro.org>
> > 
> > Reviewed-by: Mike Rapoport <rppt@linux.ibm.com>
> > 
> > Strangely, I've got a feeling I've already reviewed such patch from a
> > different person...
> 
> You're probably referring to [1] which was for arm64 and was redundant
> as my patch for that architecture was already picked up by Catalin.

I've found the patch [1] I mentioned, and it was for ARM.

> I was the person who originally introduced memblocks_present() and I'm
> still hoping to get the cleanup patches for the arm and sh arches to be
> picked up.

AFAIK, For ARM you'd need to put it into Russel's patch tracking system [2].

> Thanks,
> 
> Logan
> 
> [1]
> https://lore.kernel.org/lkml/20190210093738.30923-1-peng.fan@nxp.com/T/#u
> 

[1] https://lore.kernel.org/lkml/20190211131602.3294-1-peng.fan@nxp.com
[2] https://www.arm.linux.org.uk/developer/patches/
Logan Gunthorpe March 19, 2019, 9:12 p.m. UTC | #4
On 2019-03-19 3:05 p.m., Mike Rapoport wrote:
>> You're probably referring to [1] which was for arm64 and was redundant
>> as my patch for that architecture was already picked up by Catalin.
> 
> I've found the patch [1] I mentioned, and it was for ARM.

Ah, well, I wish knew I knew ahead of time that someone was doing my
work for me... My initial submission seemed to have been missed[1].

> AFAIK, For ARM you'd need to put it into Russel's patch tracking system [2].

Ah, I did not know this.

Logan

[1] https://lore.kernel.org/lkml/20190109202100.6968-2-logang@deltatee.com/
diff mbox series

Patch

diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 478ea8b7db87..6c50dd407ba8 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -182,21 +182,6 @@  int pfn_valid(unsigned long pfn)
 EXPORT_SYMBOL(pfn_valid);
 #endif

-#ifndef CONFIG_SPARSEMEM
-static void __init arm_memory_present(void)
-{
-}
-#else
-static void __init arm_memory_present(void)
-{
-	struct memblock_region *reg;
-
-	for_each_memblock(memory, reg)
-		memory_present(0, memblock_region_memory_base_pfn(reg),
-			       memblock_region_memory_end_pfn(reg));
-}
-#endif
-
 static bool arm_memblock_steal_permitted = true;

 phys_addr_t __init arm_memblock_steal(phys_addr_t size, phys_addr_t align)
@@ -292,7 +277,7 @@  void __init bootmem_init(void)
 	 * Sparsemem tries to allocate bootmem in memory_present(),
 	 * so must be done after the fixed reservations
 	 */
-	arm_memory_present();
+	memblocks_present();

 	/*
 	 * sparse_init() needs the bootmem allocator up and running.