Re: [PATCH 1/2] mm/page_alloc: add same penalty is enough to get round-robin order

From: Wei Yang
Date: Wed Apr 06 2022 - 19:48:04 EST


On Tue, Apr 05, 2022 at 07:11:12PM +0200, Vlastimil Babka wrote:
>On 1/23/22 02:35, Wei Yang wrote:
>> To make node order in round-robin in the same distance group, we add a
>> penalty to the first node we got in each round.
>>
>> To get a round-robin order in the same distance group, we don't need to
>> decrease the penalty since:
>>
>> * find_next_best_node() always iterates node in the same order
>> * distance matters more then penalty in find_next_best_node()
>> * in nodes with the same distance, the first one would be picked up
>>
>> So it is fine to increase same penalty when we get the first node in the
>> same distance group.
>
>With that logic I'm not even sure if we need nr_online_nodes as penalty or
>it could be just 1. Would you know?

Yes, it has the same effect.

[ 0.031849] Fallback order for Node 0: 0 1 2 3 4 5 6 7
[ 0.031854] Fallback order for Node 1: 1 2 3 0 5 6 7 4
[ 0.031857] Fallback order for Node 2: 2 3 0 1 6 7 4 5
[ 0.031860] Fallback order for Node 3: 3 0 1 2 7 4 5 6
[ 0.031864] Fallback order for Node 4: 4 5 6 7 0 1 2 3
[ 0.031867] Fallback order for Node 5: 5 6 7 4 1 2 3 0
[ 0.031870] Fallback order for Node 6: 6 7 4 5 2 3 0 1
[ 0.031873] Fallback order for Node 7: 7 4 5 6 3 0 1 2

Do you prefer to set it to 1?

--
Wei Yang
Help you, Help me