]> www.infradead.org Git - users/jedix/linux-maple.git/commit
mm: sparse: pass section_nr to find_memory_block
authorOhhoon Kwon <ohoono.kwon@samsung.com>
Mon, 23 Aug 2021 23:59:22 +0000 (09:59 +1000)
committerStephen Rothwell <sfr@canb.auug.org.au>
Wed, 25 Aug 2021 23:34:00 +0000 (09:34 +1000)
commit331e90bd32978b07702366d1efd6477b6057121b
tree12b3cca66528f7d4424a6cec1321b6cabfc40004
parent4c2cd9de65979a82a6a70b6483989776cb28a943
mm: sparse: pass section_nr to find_memory_block

With CONFIG_SPARSEMEM_EXTREME enabled, __section_nr() which converts
mem_section to section_nr could be costly since it iterates all section
roots to check if the given mem_section is in its range.

On the other hand, __nr_to_section() which converts section_nr to
mem_section can be done in O(1).

Let's pass section_nr instead of mem_section ptr to find_memory_block() in
order to reduce needless iterations.

Link: https://lkml.kernel.org/r/20210707150212.855-3-ohoono.kwon@samsung.com
Signed-off-by: Ohhoon Kwon <ohoono.kwon@samsung.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Acked-by: Mike Rapoport <rppt@linux.ibm.com>
Reviewed-by: David Hildenbrand <david@redhat.com>
Cc: Baoquan He <bhe@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Stephen Rothwell <sfr@canb.auug.org.au>
arch/powerpc/platforms/pseries/hotplug-memory.c
drivers/base/memory.c
include/linux/memory.h