diff mbox series

[3/5] mm/memory_hotplug: Tidy up node_states_clear_node

Message ID 20180919100819.25518-4-osalvador@techadventures.net (mailing list archive)
State New, archived
Headers show
Series Refactor node_states_check_changes_online/offline | expand

Commit Message

Oscar Salvador Sept. 19, 2018, 10:08 a.m. UTC
From: Oscar Salvador <osalvador@suse.de>

node_states_clear has the following if statements:

if ((N_MEMORY != N_NORMAL_MEMORY) &&
    (arg->status_change_nid_high >= 0))
        ...

if ((N_MEMORY != N_HIGH_MEMORY) &&
    (arg->status_change_nid >= 0))
        ...

N_MEMORY can never be equal to neither N_NORMAL_MEMORY nor
N_HIGH_MEMORY.

Similar problem was found in [1].
Since this is wrong, let us get rid of it.

[1] https://patchwork.kernel.org/patch/10579155/

Signed-off-by: Oscar Salvador <osalvador@suse.de>
---
 mm/memory_hotplug.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

Pasha Tatashin Sept. 20, 2018, 11:40 p.m. UTC | #1
On 9/19/18 6:08 AM, Oscar Salvador wrote:
> From: Oscar Salvador <osalvador@suse.de>
> 
> node_states_clear has the following if statements:
> 
> if ((N_MEMORY != N_NORMAL_MEMORY) &&
>     (arg->status_change_nid_high >= 0))
>         ...
> 
> if ((N_MEMORY != N_HIGH_MEMORY) &&
>     (arg->status_change_nid >= 0))
>         ...
> 
> N_MEMORY can never be equal to neither N_NORMAL_MEMORY nor
> N_HIGH_MEMORY.
> 
> Similar problem was found in [1].
> Since this is wrong, let us get rid of it.
> 
> [1] https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatchwork.kernel.org%2Fpatch%2F10579155%2F&amp;data=02%7C01%7CPavel.Tatashin%40microsoft.com%7C1e31e6a5c8754abe0b4608d61e17e01c%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636729485241367584&amp;sdata=ztkPNyRIv2c0j5lrujwGM%2FrD5in6G7AvvdqxVXCzwGs%3D&amp;reserved=0
> 
> Signed-off-by: Oscar Salvador <osalvador@suse.de>

Reviewed-by: Pavel Tatashin <pavel.tatashin@microsoft.com>

> ---
>  mm/memory_hotplug.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
> index c2c7359bd0a7..131c08106d54 100644
> --- a/mm/memory_hotplug.c
> +++ b/mm/memory_hotplug.c
> @@ -1590,12 +1590,10 @@ static void node_states_clear_node(int node, struct memory_notify *arg)
>  	if (arg->status_change_nid_normal >= 0)
>  		node_clear_state(node, N_NORMAL_MEMORY);
>  
> -	if ((N_MEMORY != N_NORMAL_MEMORY) &&
> -	    (arg->status_change_nid_high >= 0))
> +	if (arg->status_change_nid_high >= 0)
>  		node_clear_state(node, N_HIGH_MEMORY);
>  
> -	if ((N_MEMORY != N_HIGH_MEMORY) &&
> -	    (arg->status_change_nid >= 0))
> +	if (arg->status_change_nid >= 0)
>  		node_clear_state(node, N_MEMORY);
>  }
>  
>
diff mbox series

Patch

diff --git a/mm/memory_hotplug.c b/mm/memory_hotplug.c
index c2c7359bd0a7..131c08106d54 100644
--- a/mm/memory_hotplug.c
+++ b/mm/memory_hotplug.c
@@ -1590,12 +1590,10 @@  static void node_states_clear_node(int node, struct memory_notify *arg)
 	if (arg->status_change_nid_normal >= 0)
 		node_clear_state(node, N_NORMAL_MEMORY);
 
-	if ((N_MEMORY != N_NORMAL_MEMORY) &&
-	    (arg->status_change_nid_high >= 0))
+	if (arg->status_change_nid_high >= 0)
 		node_clear_state(node, N_HIGH_MEMORY);
 
-	if ((N_MEMORY != N_HIGH_MEMORY) &&
-	    (arg->status_change_nid >= 0))
+	if (arg->status_change_nid >= 0)
 		node_clear_state(node, N_MEMORY);
 }