All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mm: memory_hotplug: remove second __nr_to_section in register_page_bootmem_info_section()
@ 2017-12-07 10:29 Oscar Salvador
  2017-12-07 10:38 ` Michal Hocko
  0 siblings, 1 reply; 2+ messages in thread
From: Oscar Salvador @ 2017-12-07 10:29 UTC (permalink / raw)
  To: linux-mm; +Cc: mhocko, akpm, vbabka

In register_page_bootmem_info_section() we call __nr_to_section() in order to
get the mem_section struct at the beginning of the function.
Since we already got it, there is no need for a second call to __nr_to_section().

Signed-off-by: Oscar Salvador <osalvador@techadventures.net>
---
 mm/memory_hotplug.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index 7452a53b027f..262bfd26baf9 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -184,7 +184,7 @@ static void register_page_bootmem_info_section(unsigned long start_pfn)
 	for (i = 0; i < mapsize; i++, page++)
 		get_page_bootmem(section_nr, page, SECTION_INFO);
 
-	usemap = __nr_to_section(section_nr)->pageblock_flags;
+	usemap = ms->pageblock_flags;
 	page = virt_to_page(usemap);
 
 	mapsize = PAGE_ALIGN(usemap_size()) >> PAGE_SHIFT;
@@ -207,7 +207,7 @@ static void register_page_bootmem_info_section(unsigned long start_pfn)
 
 	register_page_bootmem_memmap(section_nr, memmap, PAGES_PER_SECTION);
 
-	usemap = __nr_to_section(section_nr)->pageblock_flags;
+	usemap = ms->pageblock_flags;
 	page = virt_to_page(usemap);
 
 	mapsize = PAGE_ALIGN(usemap_size()) >> PAGE_SHIFT;
-- 
2.13.5

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] mm: memory_hotplug: remove second __nr_to_section in register_page_bootmem_info_section()
  2017-12-07 10:29 [PATCH] mm: memory_hotplug: remove second __nr_to_section in register_page_bootmem_info_section() Oscar Salvador
@ 2017-12-07 10:38 ` Michal Hocko
  0 siblings, 0 replies; 2+ messages in thread
From: Michal Hocko @ 2017-12-07 10:38 UTC (permalink / raw)
  To: Oscar Salvador; +Cc: linux-mm, akpm, vbabka

On Thu 07-12-17 11:29:14, Oscar Salvador wrote:
> In register_page_bootmem_info_section() we call __nr_to_section() in order to
> get the mem_section struct at the beginning of the function.
> Since we already got it, there is no need for a second call to __nr_to_section().
> 
> Signed-off-by: Oscar Salvador <osalvador@techadventures.net>

Acked-by: Michal Hocko <mhocko@suse.com>

> ---
>  mm/memory_hotplug.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index 7452a53b027f..262bfd26baf9 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -184,7 +184,7 @@ static void register_page_bootmem_info_section(unsigned long start_pfn)
>  	for (i = 0; i < mapsize; i++, page++)
>  		get_page_bootmem(section_nr, page, SECTION_INFO);
>  
> -	usemap = __nr_to_section(section_nr)->pageblock_flags;
> +	usemap = ms->pageblock_flags;
>  	page = virt_to_page(usemap);
>  
>  	mapsize = PAGE_ALIGN(usemap_size()) >> PAGE_SHIFT;
> @@ -207,7 +207,7 @@ static void register_page_bootmem_info_section(unsigned long start_pfn)
>  
>  	register_page_bootmem_memmap(section_nr, memmap, PAGES_PER_SECTION);
>  
> -	usemap = __nr_to_section(section_nr)->pageblock_flags;
> +	usemap = ms->pageblock_flags;
>  	page = virt_to_page(usemap);
>  
>  	mapsize = PAGE_ALIGN(usemap_size()) >> PAGE_SHIFT;
> -- 
> 2.13.5

-- 
Michal Hocko
SUSE Labs

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-07 10:38 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-07 10:29 [PATCH] mm: memory_hotplug: remove second __nr_to_section in register_page_bootmem_info_section() Oscar Salvador
2017-12-07 10:38 ` Michal Hocko

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.