Skip to contentSkip to conversation

x86/mm: Remove the redundant conditional check

PATCH Applied Baoquan He 4 participants 7 messages Mar 11, 2020 – Mar 18, 2020

Subsystems (3)
lore
Share & tools
lore

Baoquan He

author
#0 lore raw

PATCH v2 1/1 x86/mm: Remove the redundant conditional check

In commit f70029bbaacb ("mm, memory_hotplug: drop CONFIG_MOVABLE_NODE"), the dependency on CONFIG_MOVABLE_NODE was removed for N_MEMORY. Before commit f70029bbaacb, CONFIG_HIGHMEM && !CONFIG_MOVABLE_NODE could make (N_MEMORY == N_NORMAL_MEMORY) be true. After commit f70029bbaacb, N_MEMORY doesn't have any chance to be equal to N_NORMAL_MEMORY. So the conditional check in paging_init() doesn't make sense any more. Let's remove it.

---
v1->v2:
Update patch log to make the description clearer per Michal's suggestion.

 arch/x86/mm/init_64.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/mm/init_64.c +1 -2
index abbdecb75fad..0a14711d3a93 100644
@@ -818,8 +818,7 @@ void __init paging_init(void)
 	 *	 will not set it back.
 	 */
 	node_clear_state(0, N_MEMORY);
-	if (N_MEMORY != N_NORMAL_MEMORY)
-		node_clear_state(0, N_NORMAL_MEMORY);
+	node_clear_state(0, N_NORMAL_MEMORY);
 
 	zone_sizes_init();
 }
Signature · 1 line
2.17.2
Acked-by on v2 1/1
#1 lore raw
Quoted 8 lines · Baoquan He

In commit f70029bbaacb ("mm, memory_hotplug: drop CONFIG_MOVABLE_NODE"), the dependency on CONFIG_MOVABLE_NODE was removed for N_MEMORY. Before commit f70029bbaacb, CONFIG_HIGHMEM && !CONFIG_MOVABLE_NODE could make (N_MEMORY == N_NORMAL_MEMORY) be true. After commit f70029bbaacb, N_MEMORY doesn't have any chance to be equal to N_NORMAL_MEMORY. So the conditional check in paging_init() doesn't make sense any more. Let's remove it.

Thanks!

Quoted 24 lines

---
v1->v2:
Update patch log to make the description clearer per Michal's suggestion.

 arch/x86/mm/init_64.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/mm/init_64.c +1 -2
index abbdecb75fad..0a14711d3a93 100644
@@ -818,8 +818,7 @@ void __init paging_init(void)
 	 *	 will not set it back.
 	 */
 	node_clear_state(0, N_MEMORY);
-	if (N_MEMORY != N_NORMAL_MEMORY)
-		node_clear_state(0, N_NORMAL_MEMORY);
+	node_clear_state(0, N_NORMAL_MEMORY);
 
 	zone_sizes_init();
 }
Signature · 1 line
2.17.2
Signature · 2 lines
Michal Hocko
SUSE Labs
Reviewed-by on v2 1/1
#2 lore raw
In reply to Baoquan He
Quoted 8 lines · Baoquan He

In commit f70029bbaacb ("mm, memory_hotplug: drop CONFIG_MOVABLE_NODE"), the dependency on CONFIG_MOVABLE_NODE was removed for N_MEMORY. Before commit f70029bbaacb, CONFIG_HIGHMEM && !CONFIG_MOVABLE_NODE could make (N_MEMORY == N_NORMAL_MEMORY) be true. After commit f70029bbaacb, N_MEMORY doesn't have any chance to be equal to N_NORMAL_MEMORY. So the conditional check in paging_init() doesn't make sense any more. Let's remove it.

The change looks good. While I have one question, we set default value for N_HIGH_MEMORY. Why we don't clear this too?

Quoted 24 lines

---
v1->v2:
Update patch log to make the description clearer per Michal's suggestion.

arch/x86/mm/init_64.c | 3 +--

1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/mm/init_64.c +1 -2
index abbdecb75fad..0a14711d3a93 100644
@@ -818,8 +818,7 @@ void __init paging_init(void)
 	 *	 will not set it back.
 	 */
 	node_clear_state(0, N_MEMORY);
-	if (N_MEMORY != N_NORMAL_MEMORY)
-		node_clear_state(0, N_NORMAL_MEMORY);
+	node_clear_state(0, N_NORMAL_MEMORY);
 
 	zone_sizes_init();
 }
Signature · 1 line
2.17.2
Signature · 2 lines
Wei Yang
Help you, Help me
author
#3 lore raw
Quoted 8 lines · Wei Yang
Quoted 7 lines · Baoquan He

In commit f70029bbaacb ("mm, memory_hotplug: drop CONFIG_MOVABLE_NODE"), the dependency on CONFIG_MOVABLE_NODE was removed for N_MEMORY. Before commit f70029bbaacb, CONFIG_HIGHMEM && !CONFIG_MOVABLE_NODE could make (N_MEMORY == N_NORMAL_MEMORY) be true. After commit f70029bbaacb, N_MEMORY doesn't have any chance to be equal to N_NORMAL_MEMORY. So the conditional check in paging_init() doesn't make sense any more. Let's remove it.

Quoted 4 lines
Quoted 1 line

The change looks good. While I have one question, we set default value for N_HIGH_MEMORY. Why we don't clear this too?

This is for x86_64 only, there's no node_state for N_HIGH_MEMORY.

Quoted 32 lines
Quoted 24 lines

---
v1->v2:
Update patch log to make the description clearer per Michal's suggestion.

arch/x86/mm/init_64.c | 3 +--

1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/mm/init_64.c +1 -2
index abbdecb75fad..0a14711d3a93 100644
@@ -818,8 +818,7 @@ void __init paging_init(void)
 	 *	 will not set it back.
 	 */
 	node_clear_state(0, N_MEMORY);
-	if (N_MEMORY != N_NORMAL_MEMORY)
-		node_clear_state(0, N_NORMAL_MEMORY);
+	node_clear_state(0, N_NORMAL_MEMORY);
 
 	zone_sizes_init();
 }
Signature · 1 line
2.17.2
Signature · 2 lines
Wei Yang
Help you, Help me
#4 lore raw
Quoted 9 lines · Baoquan He
Quoted 8 lines · Wei Yang
Quoted 7 lines · Baoquan He

In commit f70029bbaacb ("mm, memory_hotplug: drop CONFIG_MOVABLE_NODE"), the dependency on CONFIG_MOVABLE_NODE was removed for N_MEMORY. Before commit f70029bbaacb, CONFIG_HIGHMEM && !CONFIG_MOVABLE_NODE could make (N_MEMORY == N_NORMAL_MEMORY) be true. After commit f70029bbaacb, N_MEMORY doesn't have any chance to be equal to N_NORMAL_MEMORY. So the conditional check in paging_init() doesn't make sense any more. Let's remove it.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

The change looks good. While I have one question, we set default value for N_HIGH_MEMORY. Why we don't clear this too?

This is for x86_64 only, there's no node_state for N_HIGH_MEMORY.

Thanks, I see it in arch/x86/Kconfig.

Signature · 2 lines
Wei Yang
Help you, Help me
merge bot Applied
#5 lore raw

[tip: x86/mm] x86/mm: Remove the now redundant N_MEMORY check

In reply to Baoquan He
The following commit has been merged into the x86/mm branch of tip:

The following commit has been merged into the x86/mm branch of tip:

Commit-ID:     aa61ee7b9ee3cb84c0d3a842b0d17937bf024c46
Gitweb:        https://git.kernel.org/tip/aa61ee7b9ee3cb84c0d3a842b0d17937bf024c46
Author:        Baoquan He <[email protected]>
AuthorDate:    Wed, 11 Mar 2020 09:18:23 +08:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Tue, 17 Mar 2020 19:12:39 +01:00

x86/mm: Remove the now redundant N_MEMORY check

In commit

f70029bbaacb ("mm, memory_hotplug: drop CONFIG_MOVABLE_NODE")

the dependency on CONFIG_MOVABLE_NODE was removed for N_MEMORY. Before, CONFIG_HIGHMEM && !CONFIG_MOVABLE_NODE could make (N_MEMORY == N_NORMAL_MEMORY) be true.

After that commit, N_MEMORY cannot be equal to N_NORMAL_MEMORY. So the conditional check in paging_init() is not needed anymore, remove it.

[ bp: Massage. ]

---
 arch/x86/mm/init_64.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/mm/init_64.c +1 -2
index abbdecb..0a14711 100644
@@ -818,8 +818,7 @@ void __init paging_init(void)
 	 *	 will not set it back.
 	 */
 	node_clear_state(0, N_MEMORY);
-	if (N_MEMORY != N_NORMAL_MEMORY)
-		node_clear_state(0, N_NORMAL_MEMORY);
+	node_clear_state(0, N_NORMAL_MEMORY);
 
 	zone_sizes_init();
 }
author
#6 lore raw

Re: [tip: x86/mm] x86/mm: Remove the now redundant N_MEMORY check

Hi,

Quoted 8 lines · On 03/17/20 at 06:20pm, tip-bot2 for Baoquan He wrote:

The following commit has been merged into the x86/mm branch of tip:

Commit-ID:     aa61ee7b9ee3cb84c0d3a842b0d17937bf024c46
Gitweb:        https://git.kernel.org/tip/aa61ee7b9ee3cb84c0d3a842b0d17937bf024c46
Author:        Baoquan He <[email protected]>
AuthorDate:    Wed, 11 Mar 2020 09:18:23 +08:00
Committer:     Borislav Petkov <[email protected]>
CommitterDate: Tue, 17 Mar 2020 19:12:39 +01:00

Just a soft reminder, I also got a notice from Andrew that this was picked into his -mm tree before. Maybe one can be dropped to avoid conflict when sending to Linus.

Thanks for taking care of this.

Quoted 40 lines

x86/mm: Remove the now redundant N_MEMORY check

In commit

f70029bbaacb ("mm, memory_hotplug: drop CONFIG_MOVABLE_NODE")

the dependency on CONFIG_MOVABLE_NODE was removed for N_MEMORY. Before, CONFIG_HIGHMEM && !CONFIG_MOVABLE_NODE could make (N_MEMORY == N_NORMAL_MEMORY) be true.

After that commit, N_MEMORY cannot be equal to N_NORMAL_MEMORY. So the conditional check in paging_init() is not needed anymore, remove it.

[ bp: Massage. ]

---
 arch/x86/mm/init_64.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
arch/x86/mm/init_64.c +1 -2
index abbdecb..0a14711 100644
@@ -818,8 +818,7 @@ void __init paging_init(void)
 	 *	 will not set it back.
 	 */
 	node_clear_state(0, N_MEMORY);
-	if (N_MEMORY != N_NORMAL_MEMORY)
-		node_clear_state(0, N_NORMAL_MEMORY);
+	node_clear_state(0, N_NORMAL_MEMORY);
 
 	zone_sizes_init();
 }