linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] x86/mm: Remove the redundant conditional check
@ 2020-03-11  1:18 Baoquan He
  2020-03-11  9:27 ` Michal Hocko
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Baoquan He @ 2020-03-11  1:18 UTC (permalink / raw)
  To: linux-kernel; +Cc: linux-mm, x86, mhocko, akpm, bhe

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.

Signed-off-by: Baoquan He <bhe@redhat.com>
---
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(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index abbdecb75fad..0a14711d3a93 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -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();
 }
-- 
2.17.2


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] x86/mm: Remove the redundant conditional check
  2020-03-11  1:18 [PATCH v2] x86/mm: Remove the redundant conditional check Baoquan He
@ 2020-03-11  9:27 ` Michal Hocko
  2020-03-14 15:10 ` Wei Yang
  2020-03-17 18:20 ` [tip: x86/mm] x86/mm: Remove the now redundant N_MEMORY check tip-bot2 for Baoquan He
  2 siblings, 0 replies; 7+ messages in thread
From: Michal Hocko @ 2020-03-11  9:27 UTC (permalink / raw)
  To: Baoquan He; +Cc: linux-kernel, linux-mm, x86, akpm

On Wed 11-03-20 09:18:23, Baoquan He wrote:
> 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.
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>

Acked-by: Michal Hocko <mhocko@suse.com>
Thanks!

> ---
> 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(-)
> 
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index abbdecb75fad..0a14711d3a93 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -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();
>  }
> -- 
> 2.17.2

-- 
Michal Hocko
SUSE Labs

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] x86/mm: Remove the redundant conditional check
  2020-03-11  1:18 [PATCH v2] x86/mm: Remove the redundant conditional check Baoquan He
  2020-03-11  9:27 ` Michal Hocko
@ 2020-03-14 15:10 ` Wei Yang
  2020-03-15 12:49   ` Baoquan He
  2020-03-17 18:20 ` [tip: x86/mm] x86/mm: Remove the now redundant N_MEMORY check tip-bot2 for Baoquan He
  2 siblings, 1 reply; 7+ messages in thread
From: Wei Yang @ 2020-03-14 15:10 UTC (permalink / raw)
  To: Baoquan He; +Cc: linux-kernel, linux-mm, x86, mhocko, akpm

On Wed, Mar 11, 2020 at 09:18:23AM +0800, Baoquan He wrote:
>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.
>
>Signed-off-by: Baoquan He <bhe@redhat.com>

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

Reviewed-by: Wei Yang <richard.weiyang@gmail.com>

>---
>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(-)
>
>diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
>index abbdecb75fad..0a14711d3a93 100644
>--- a/arch/x86/mm/init_64.c
>+++ b/arch/x86/mm/init_64.c
>@@ -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();
> }
>-- 
>2.17.2

-- 
Wei Yang
Help you, Help me

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] x86/mm: Remove the redundant conditional check
  2020-03-14 15:10 ` Wei Yang
@ 2020-03-15 12:49   ` Baoquan He
  2020-03-15 21:56     ` Wei Yang
  0 siblings, 1 reply; 7+ messages in thread
From: Baoquan He @ 2020-03-15 12:49 UTC (permalink / raw)
  To: Wei Yang; +Cc: linux-kernel, linux-mm, x86, mhocko, akpm

On 03/14/20 at 03:10pm, Wei Yang wrote:
> On Wed, Mar 11, 2020 at 09:18:23AM +0800, Baoquan He wrote:
> >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.
> >
> >Signed-off-by: Baoquan He <bhe@redhat.com>
> 
> 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.

> 
> Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
> 
> >---
> >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(-)
> >
> >diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> >index abbdecb75fad..0a14711d3a93 100644
> >--- a/arch/x86/mm/init_64.c
> >+++ b/arch/x86/mm/init_64.c
> >@@ -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();
> > }
> >-- 
> >2.17.2
> 
> -- 
> Wei Yang
> Help you, Help me
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v2] x86/mm: Remove the redundant conditional check
  2020-03-15 12:49   ` Baoquan He
@ 2020-03-15 21:56     ` Wei Yang
  0 siblings, 0 replies; 7+ messages in thread
From: Wei Yang @ 2020-03-15 21:56 UTC (permalink / raw)
  To: Baoquan He; +Cc: Wei Yang, linux-kernel, linux-mm, x86, mhocko, akpm

On Sun, Mar 15, 2020 at 08:49:13PM +0800, Baoquan He wrote:
>On 03/14/20 at 03:10pm, Wei Yang wrote:
>> On Wed, Mar 11, 2020 at 09:18:23AM +0800, Baoquan He wrote:
>> >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.
>> >
>> >Signed-off-by: Baoquan He <bhe@redhat.com>
>> 
>> 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.

-- 
Wei Yang
Help you, Help me

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [tip: x86/mm] x86/mm: Remove the now redundant N_MEMORY check
  2020-03-11  1:18 [PATCH v2] x86/mm: Remove the redundant conditional check Baoquan He
  2020-03-11  9:27 ` Michal Hocko
  2020-03-14 15:10 ` Wei Yang
@ 2020-03-17 18:20 ` tip-bot2 for Baoquan He
  2020-03-18  2:49   ` Baoquan He
  2 siblings, 1 reply; 7+ messages in thread
From: tip-bot2 for Baoquan He @ 2020-03-17 18:20 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: Baoquan He, Borislav Petkov, Wei Yang, Michal Hocko, x86, LKML

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 <bhe@redhat.com>
AuthorDate:    Wed, 11 Mar 2020 09:18:23 +08:00
Committer:     Borislav Petkov <bp@suse.de>
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. ]

Signed-off-by: Baoquan He <bhe@redhat.com>
Signed-off-by: Borislav Petkov <bp@suse.de>
Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
Acked-by: Michal Hocko <mhocko@suse.com>
Link: https://lkml.kernel.org/r/20200311011823.27740-1-bhe@redhat.com
---
 arch/x86/mm/init_64.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
index abbdecb..0a14711 100644
--- a/arch/x86/mm/init_64.c
+++ b/arch/x86/mm/init_64.c
@@ -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();
 }

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [tip: x86/mm] x86/mm: Remove the now redundant N_MEMORY check
  2020-03-17 18:20 ` [tip: x86/mm] x86/mm: Remove the now redundant N_MEMORY check tip-bot2 for Baoquan He
@ 2020-03-18  2:49   ` Baoquan He
  0 siblings, 0 replies; 7+ messages in thread
From: Baoquan He @ 2020-03-18  2:49 UTC (permalink / raw)
  To: Borislav Petkov, akpm; +Cc: linux-kernel

Hi,

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 <bhe@redhat.com>
> AuthorDate:    Wed, 11 Mar 2020 09:18:23 +08:00
> Committer:     Borislav Petkov <bp@suse.de>
> 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.

> 
> 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. ]
> 
> Signed-off-by: Baoquan He <bhe@redhat.com>
> Signed-off-by: Borislav Petkov <bp@suse.de>
> Reviewed-by: Wei Yang <richard.weiyang@gmail.com>
> Acked-by: Michal Hocko <mhocko@suse.com>
> Link: https://lkml.kernel.org/r/20200311011823.27740-1-bhe@redhat.com
> ---
>  arch/x86/mm/init_64.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/arch/x86/mm/init_64.c b/arch/x86/mm/init_64.c
> index abbdecb..0a14711 100644
> --- a/arch/x86/mm/init_64.c
> +++ b/arch/x86/mm/init_64.c
> @@ -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();
>  }
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-03-18  2:49 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11  1:18 [PATCH v2] x86/mm: Remove the redundant conditional check Baoquan He
2020-03-11  9:27 ` Michal Hocko
2020-03-14 15:10 ` Wei Yang
2020-03-15 12:49   ` Baoquan He
2020-03-15 21:56     ` Wei Yang
2020-03-17 18:20 ` [tip: x86/mm] x86/mm: Remove the now redundant N_MEMORY check tip-bot2 for Baoquan He
2020-03-18  2:49   ` Baoquan He

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).