Re: [PATCH v2 3/4] mm/memory_hotplug: Simplify node_states_check_changes_online

From: Pasha Tatashin
Date: Fri Sep 21 2018 - 10:25:42 EST




On 9/21/18 9:26 AM, Oscar Salvador wrote:
> From: Oscar Salvador <osalvador@xxxxxxx>
>
> While looking at node_states_check_changes_online, I stumbled
> upon some confusing things.
>
> Right after entering the function, we find this:
>
> if (N_MEMORY == N_NORMAL_MEMORY)
> zone_last = ZONE_MOVABLE;
>
> This is wrong.
> N_MEMORY cannot really be equal to N_NORMAL_MEMORY.
> My guess is that this wanted to be something like:
>
> if (N_NORMAL_MEMORY == N_HIGH_MEMORY)
>
> to check if we have CONFIG_HIGHMEM.
>
> Later on, in the CONFIG_HIGHMEM block, we have:
>
> if (N_MEMORY == N_HIGH_MEMORY)
> zone_last = ZONE_MOVABLE;
>
> Again, this is wrong, and will never be evaluated to true.
>
> Besides removing these wrong if statements, I simplified
> the function a bit.
>
> Signed-off-by: Oscar Salvador <osalvador@xxxxxxx>
> Suggested-by: Pavel Tatashin <pavel.tatashin@xxxxxxxxxxxxx>

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