* Re: [PATCH] mm/mm_init.c: only align start of ZONE_MOVALBE on nodes with memory
2025-02-11 8:29 [PATCH] mm/mm_init.c: only align start of ZONE_MOVALBE on nodes with memory Wei Yang
@ 2025-02-11 15:26 ` David Hildenbrand
2025-02-12 0:46 ` Wei Yang
2025-02-12 15:57 ` Dev Jain
` (2 subsequent siblings)
3 siblings, 1 reply; 7+ messages in thread
From: David Hildenbrand @ 2025-02-11 15:26 UTC (permalink / raw)
To: Wei Yang, rppt, akpm; +Cc: linux-mm
On 11.02.25 09:29, Wei Yang wrote:
> At the beginning of find_zone_movable_pfns_for_nodes(), it has properly
> set node_states[N_MEMORY] in early_calculate_totalpages().
>
> Instead of iterate on all possible nodes, we can just do the alignment
> on nodes with memory.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---
> mm/mm_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 35754a8ae6c0..3ec50b5fda12 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -547,7 +547,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
>
> out2:
> /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */
> - for (nid = 0; nid < MAX_NUMNODES; nid++) {
> + for_each_node_state(nid, N_MEMORY) {
> unsigned long start_pfn, end_pfn;
>
> zone_movable_pfn[nid] =
I think this should work
Acked-by: David Hildenbrand <david@redhat.com>
--
Cheers,
David / dhildenb
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mm/mm_init.c: only align start of ZONE_MOVALBE on nodes with memory
2025-02-11 15:26 ` David Hildenbrand
@ 2025-02-12 0:46 ` Wei Yang
0 siblings, 0 replies; 7+ messages in thread
From: Wei Yang @ 2025-02-12 0:46 UTC (permalink / raw)
To: David Hildenbrand; +Cc: Wei Yang, rppt, akpm, linux-mm
On Tue, Feb 11, 2025 at 04:26:26PM +0100, David Hildenbrand wrote:
>On 11.02.25 09:29, Wei Yang wrote:
>> At the beginning of find_zone_movable_pfns_for_nodes(), it has properly
>> set node_states[N_MEMORY] in early_calculate_totalpages().
>>
>> Instead of iterate on all possible nodes, we can just do the alignment
>> on nodes with memory.
>>
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> ---
>> mm/mm_init.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/mm_init.c b/mm/mm_init.c
>> index 35754a8ae6c0..3ec50b5fda12 100644
>> --- a/mm/mm_init.c
>> +++ b/mm/mm_init.c
>> @@ -547,7 +547,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
>> out2:
>> /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */
>> - for (nid = 0; nid < MAX_NUMNODES; nid++) {
>> + for_each_node_state(nid, N_MEMORY) {
>> unsigned long start_pfn, end_pfn;
>> zone_movable_pfn[nid] =
>
>I think this should work
>
>Acked-by: David Hildenbrand <david@redhat.com>
>
Thanks :-)
>--
>Cheers,
>
>David / dhildenb
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/mm_init.c: only align start of ZONE_MOVALBE on nodes with memory
2025-02-11 8:29 [PATCH] mm/mm_init.c: only align start of ZONE_MOVALBE on nodes with memory Wei Yang
2025-02-11 15:26 ` David Hildenbrand
@ 2025-02-12 15:57 ` Dev Jain
2025-02-12 23:34 ` Wei Yang
2025-02-13 4:27 ` Anshuman Khandual
2025-02-13 6:31 ` Mike Rapoport
3 siblings, 1 reply; 7+ messages in thread
From: Dev Jain @ 2025-02-12 15:57 UTC (permalink / raw)
To: Wei Yang, rppt, akpm; +Cc: linux-mm
On 11/02/25 1:59 pm, Wei Yang wrote:
> At the beginning of find_zone_movable_pfns_for_nodes(), it has properly
> set node_states[N_MEMORY] in early_calculate_totalpages().
>
> Instead of iterate on all possible nodes, we can just do the alignment
> on nodes with memory.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---
> mm/mm_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 35754a8ae6c0..3ec50b5fda12 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -547,7 +547,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
>
> out2:
> /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */
> - for (nid = 0; nid < MAX_NUMNODES; nid++) {
> + for_each_node_state(nid, N_MEMORY) {
> unsigned long start_pfn, end_pfn;
>
> zone_movable_pfn[nid] =
I have boot tested this, and also read the code and it makes sense: The
only flag which gives the possibility of ZONE_MOVABLE is N_MEMORY, and
it gets set in early_calculate_totalpages(), and before the label out2,
no function plays with node_states[]. So please consider:
Reviewed-by: Dev Jain <dev.jain@arm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mm/mm_init.c: only align start of ZONE_MOVALBE on nodes with memory
2025-02-12 15:57 ` Dev Jain
@ 2025-02-12 23:34 ` Wei Yang
0 siblings, 0 replies; 7+ messages in thread
From: Wei Yang @ 2025-02-12 23:34 UTC (permalink / raw)
To: Dev Jain; +Cc: Wei Yang, rppt, akpm, linux-mm
On Wed, Feb 12, 2025 at 09:27:08PM +0530, Dev Jain wrote:
>
>
>On 11/02/25 1:59 pm, Wei Yang wrote:
>> At the beginning of find_zone_movable_pfns_for_nodes(), it has properly
>> set node_states[N_MEMORY] in early_calculate_totalpages().
>>
>> Instead of iterate on all possible nodes, we can just do the alignment
>> on nodes with memory.
>>
>> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
>> ---
>> mm/mm_init.c | 2 +-
>> 1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/mm/mm_init.c b/mm/mm_init.c
>> index 35754a8ae6c0..3ec50b5fda12 100644
>> --- a/mm/mm_init.c
>> +++ b/mm/mm_init.c
>> @@ -547,7 +547,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
>> out2:
>> /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */
>> - for (nid = 0; nid < MAX_NUMNODES; nid++) {
>> + for_each_node_state(nid, N_MEMORY) {
>> unsigned long start_pfn, end_pfn;
>> zone_movable_pfn[nid] =
>
>I have boot tested this, and also read the code and it makes sense: The only
>flag which gives the possibility of ZONE_MOVABLE is N_MEMORY, and it gets set
>in early_calculate_totalpages(), and before the label out2, no function plays
>with node_states[]. So please consider:
>
>Reviewed-by: Dev Jain <dev.jain@arm.com>
Thanks :-)
--
Wei Yang
Help you, Help me
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] mm/mm_init.c: only align start of ZONE_MOVALBE on nodes with memory
2025-02-11 8:29 [PATCH] mm/mm_init.c: only align start of ZONE_MOVALBE on nodes with memory Wei Yang
2025-02-11 15:26 ` David Hildenbrand
2025-02-12 15:57 ` Dev Jain
@ 2025-02-13 4:27 ` Anshuman Khandual
2025-02-13 6:31 ` Mike Rapoport
3 siblings, 0 replies; 7+ messages in thread
From: Anshuman Khandual @ 2025-02-13 4:27 UTC (permalink / raw)
To: Wei Yang, rppt, akpm; +Cc: linux-mm
On 2/11/25 13:59, Wei Yang wrote:
> At the beginning of find_zone_movable_pfns_for_nodes(), it has properly
> set node_states[N_MEMORY] in early_calculate_totalpages().
>
> Instead of iterate on all possible nodes, we can just do the alignment
> on nodes with memory.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
> ---
> mm/mm_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 35754a8ae6c0..3ec50b5fda12 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -547,7 +547,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
>
> out2:
> /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */
> - for (nid = 0; nid < MAX_NUMNODES; nid++) {
> + for_each_node_state(nid, N_MEMORY) {
> unsigned long start_pfn, end_pfn;
>
> zone_movable_pfn[nid] =
LGTM
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
^ permalink raw reply [flat|nested] 7+ messages in thread* Re: [PATCH] mm/mm_init.c: only align start of ZONE_MOVALBE on nodes with memory
2025-02-11 8:29 [PATCH] mm/mm_init.c: only align start of ZONE_MOVALBE on nodes with memory Wei Yang
` (2 preceding siblings ...)
2025-02-13 4:27 ` Anshuman Khandual
@ 2025-02-13 6:31 ` Mike Rapoport
3 siblings, 0 replies; 7+ messages in thread
From: Mike Rapoport @ 2025-02-13 6:31 UTC (permalink / raw)
To: Wei Yang; +Cc: akpm, linux-mm
On Tue, Feb 11, 2025 at 08:29:00AM +0000, Wei Yang wrote:
> At the beginning of find_zone_movable_pfns_for_nodes(), it has properly
> set node_states[N_MEMORY] in early_calculate_totalpages().
>
> Instead of iterate on all possible nodes, we can just do the alignment
> on nodes with memory.
>
> Signed-off-by: Wei Yang <richard.weiyang@gmail.com>
Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org>
> ---
> mm/mm_init.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/mm/mm_init.c b/mm/mm_init.c
> index 35754a8ae6c0..3ec50b5fda12 100644
> --- a/mm/mm_init.c
> +++ b/mm/mm_init.c
> @@ -547,7 +547,7 @@ static void __init find_zone_movable_pfns_for_nodes(void)
>
> out2:
> /* Align start of ZONE_MOVABLE on all nids to MAX_ORDER_NR_PAGES */
> - for (nid = 0; nid < MAX_NUMNODES; nid++) {
> + for_each_node_state(nid, N_MEMORY) {
> unsigned long start_pfn, end_pfn;
>
> zone_movable_pfn[nid] =
> --
> 2.34.1
>
--
Sincerely yours,
Mike.
^ permalink raw reply [flat|nested] 7+ messages in thread