Re: [PATCH] mm/page_alloc: Clean up check_for_memory

From: Oscar Salvador
Date: Fri Aug 31 2018 - 16:45:48 EST


On Fri, Aug 31, 2018 at 02:04:59PM +0000, Pasha Tatashin wrote:
> Are you saying the code that is in mainline is broken? Because we set
> node_set_state(nid, N_NORMAL_MEMORY); even on node with N_HIGH_MEMORY:
>
> 6826 if (N_NORMAL_MEMORY != N_HIGH_MEMORY &&
> 6827 zone_type <= ZONE_NORMAL)
> 6828 node_set_state(nid, N_NORMAL_MEMORY);

Yes, and that is fine. Although the curent code is subtle for the reasons
I expplained in the changelog.
What I am saying is that the code you suggested would not work
because your code either sets N_NORMAL_MEMORY or N_HIGH_MEMORY and then
breaks the loop.

That is wrong because when we are on a CONFIG_HIGHMEM system,
it can happen that we have a node with both types, so we have to set
both types of memory.

N_HIGH_MEMORY, and N_NORMAL_MEMORY if the zone is <= ZONE_NORMAL.

Thanks
--
Oscar Salvador
SUSE L3