mm/memory_hotplug.c: tidy up node_states_clear_node()
authorOscar Salvador <osalvador@suse.de>
Fri, 26 Oct 2018 22:07:28 +0000 (15:07 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 26 Oct 2018 23:26:33 +0000 (16:26 -0700)
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/

Link: http://lkml.kernel.org/r/20180919100819.25518-4-osalvador@techadventures.net
Signed-off-by: Oscar Salvador <osalvador@suse.de>
Reviewed-by: Pavel Tatashin <pavel.tatashin@microsoft.com>
Cc: Dan Williams <dan.j.williams@intel.com>
Cc: David Hildenbrand <david@redhat.com>
Cc: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Cc: Mathieu Malaterre <malat@debian.org>
Cc: Michal Hocko <mhocko@suse.com>
Cc: <yasu.isimatu@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
mm/memory_hotplug.c

index 63facfc5722487d9c843eb48da78f95eb58324fe..561c44761f9548be929d1c255a2cf29a93f15e5b 100644 (file)
@@ -1582,12 +1582,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);
 }