Re: [PATCH] x86,NUMA:Get the number of ram pages directly in numa_meminfo_cover_memory()

From: Liam Ni
Date: Thu Jun 22 2023 - 01:06:28 EST


On Thu, 22 Jun 2023 at 01:49, Dave Hansen <dave.hansen@xxxxxxxxx> wrote:
>
> On 6/15/23 07:20, Liam Ni wrote:
> > In a previous implementation,The ram page is calculated
> > by counting the number of holes,
> > however,the number of ram pages is calculated during hole calculation.
> > Therefore,we can directly calculate the amount of ram pages.
>
> What problem does this patch solve?

I has send patch V2 to improve the execution efficiency of
numa_meminfo_cover_memory()
by optimize the way of calculating missing pages.

patch V2:
https://lore.kernel.org/all/20230619075315.49114-1-zhiguangni01@xxxxxxxxx/

In the previous implementation, We calculate missing pages as follows:
1. calculate numaram by traverse all the numa_meminfo's and for each of
them traverse all the regions in memblock.memory to prepare for
counting missing pages.

2. Traverse all the regions in memblock.memory again to get e820ram.

3. the missing page is (e820ram - numaram )

But,it's enough to count memory in memblock.memory that doesn't have
the node assigned.
we only need to traverse memblock.memory **once**.