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

2018-08-31 Thread Oscar Salvador
On Fri, Aug 31, 2018 at 02:04:59PM +, 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

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

2018-08-31 Thread Pasha Tatashin
On 8/31/18 8:24 AM, Oscar Salvador wrote: > On Thu, Aug 30, 2018 at 01:55:29AM +, Pasha Tatashin wrote: >> I would re-write the above function like this: >> static void check_for_memory(pg_data_t *pgdat, int nid) >> { >> enum zone_type zone_type; >> >> for (zone_type = 0; zone

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

2018-08-31 Thread Oscar Salvador
On Thu, Aug 30, 2018 at 01:55:29AM +, Pasha Tatashin wrote: > I would re-write the above function like this: > static void check_for_memory(pg_data_t *pgdat, int nid) > { > enum zone_type zone_type; > > for (zone_type = 0; zone_type < ZONE_MOVABLE; zone_type++) { >

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

2018-08-29 Thread Pasha Tatashin
On 8/28/18 5:01 PM, Oscar Salvador wrote: > From: Oscar Salvador > > check_for_memory looks a bit confusing. > First of all, we have this: > > if (N_MEMORY == N_NORMAL_MEMORY) > return; > > Checking the ENUM declaration, looks like N_MEMORY canot be equal to > N_NORMAL_MEMORY. > I could

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

2018-08-29 Thread Oscar Salvador
On Tue, Aug 28, 2018 at 02:35:30PM -0700, Andrew Morton wrote: > > First, we should only set N_HIGH_MEMORY in case we have > > CONFIG_HIGHMEM. > > Why? Just a teeny optimization? Hi Andrew, Optimization was not really my point here, my point was to make the code less subtle and more clear. One

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

2018-08-28 Thread Andrew Morton
On Tue, 28 Aug 2018 23:01:58 +0200 Oscar Salvador wrote: > From: Oscar Salvador > > check_for_memory looks a bit confusing. > First of all, we have this: > > if (N_MEMORY == N_NORMAL_MEMORY) > return; > > Checking the ENUM declaration, looks like N_MEMORY canot be equal to > N_NORMAL_M

[PATCH] mm/page_alloc: Clean up check_for_memory

2018-08-28 Thread Oscar Salvador
From: Oscar Salvador check_for_memory looks a bit confusing. First of all, we have this: if (N_MEMORY == N_NORMAL_MEMORY) return; Checking the ENUM declaration, looks like N_MEMORY canot be equal to N_NORMAL_MEMORY. I could not find where N_MEMORY is set to N_NORMAL_MEMORY, or the other