Re: [PATCH 2/3] mm: sparse: pass section_nr to find_memory_block

From: David Hildenbrand
Date: Fri Jul 02 2021 - 13:55:34 EST


On 02.07.21 11:41, Ohhoon Kwon wrote:
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.

Signed-off-by: Ohhoon Kwon <ohoono.kwon@xxxxxxxxxxx>


Reviewed-by: David Hildenbrand <david@xxxxxxxxxx>

--
Thanks,

David / dhildenb