Re: [PATCH] bounds: Support non-power-of-two CONFIG_NR_CPUS

From: Rik van Riel
Date: Tue Oct 10 2023 - 11:19:58 EST


On Tue, 2023-10-10 at 15:55 +0100, Matthew Wilcox (Oracle) wrote:
> ilog2() rounds down, so for example when PowerPC 85xx sets
> CONFIG_NR_CPUS
> to 24, we will only allocate 4 bits to store the number of CPUs
> instead
> of 5.  Use bits_per() instead, which rounds up.  Found by code
> inspection.
> The effect of this would probably be a misaccounting when doing NUMA
> balancing, so to a user, it would only be a performance penalty.
> The effects may be more wide-spread; it's hard to tell.
>
> Signed-off-by: Matthew Wilcox (Oracle) <willy@xxxxxxxxxxxxx>
> Fixes: 90572890d202 ("mm: numa: Change page last {nid,pid} into
> {cpu,pid}")
> Cc: Peter Zijlstra <peterz@xxxxxxxxxxxxx>
> Cc: Mel Gorman <mgorman@xxxxxxxxxxxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxxxxx>
> Cc: Rik van Riel <riel@xxxxxxxxxxx>

Reviewed-by: Rik van Riel <riel@xxxxxxxxxxx>

--
All Rights Reversed.