Re: [PATCH] drivers/base/memory: Avoid overhead from for_each_present_section_nr()

From: Oscar Salvador
Date: Fri Apr 11 2025 - 04:30:42 EST


On Fri, Apr 11, 2025 at 03:04:16PM +1000, Gavin Shan wrote:
> I think it's a good point. Tried a quick test on a ARM64 machine whose memory
> capacity is 1TB. Leaping 'nr' by 'sections_per_block' improves the performance a bit,
> even it's not too much. The time taken by memory_dev_init() drops from 110ms to 100ms.
> For the IBM Power9 machine (64GB memory) I have, there are not too much space to be
> improved because the time taken by memory_dev_init() is only 10ms. I will post a patch
> for review after this patch gets merged, if you agree.

I have a patch that looked pretty much the same because I wanted to try
it out after commenting it to David, to see the "gains".
On a x86 system with 100GB and memory-blocks spanning 8 sections, I saw
a gain of 12us.
Of course, that kinda of accumulates wrt. memory capacity.



--
Oscar Salvador
SUSE Labs