Re: [PATCH] mm: use managed_zone() for more exact check in zone iteration
From: Wei Yang
Date: Thu Nov 15 2018 - 23:41:47 EST
On Thu, Nov 15, 2018 at 01:37:35PM -0800, Andrew Morton wrote:
>On Thu, 15 Nov 2018 07:50:40 +0800 Wei Yang <richard.weiyang@xxxxxxxxx> wrote:
>
>> For one zone, there are three digits to describe its space range:
>>
>> spanned_pages
>> present_pages
>> managed_pages
>>
>> The detailed meaning is written in include/linux/mmzone.h. This patch
>> concerns about the last two.
>>
>> present_pages is physical pages existing within the zone
>> managed_pages is present pages managed by the buddy system
>>
>> >From the definition, managed_pages is a more strict condition than
>> present_pages.
>>
>> There are two functions using zone's present_pages as a boundary:
>>
>> populated_zone()
>> for_each_populated_zone()
>>
>> By going through the kernel tree, most of their users are willing to
>> access pages managed by the buddy system, which means it is more exact
>> to check zone's managed_pages for a validation.
>>
>> This patch replaces those checks on present_pages to managed_pages by:
>>
>> * change for_each_populated_zone() to for_each_managed_zone()
>> * convert for_each_populated_zone() to for_each_zone() and check
>> populated_zone() where is necessary
>> * change populated_zone() to managed_zone() at proper places
>>
>> Signed-off-by: Wei Yang <richard.weiyang@xxxxxxxxx>
>>
>> ---
>>
>> Michal, after last mail, I did one more thing to replace
>> populated_zone() with managed_zone() at proper places.
>>
>> One thing I am not sure is those places in mm/compaction.c. I have
>> chaged them. If not, please let me know.
>>
>> BTW, I did a boot up test with the patched kernel and looks smooth.
>
>Seems sensible, but a bit scary. A basic boot test is unlikely to
>expose subtle gremlins.
>
Agree.
>Worse, the situations in which managed_zone() != populated_zone() are
>rare(?), so it will take a long time for problems to be discovered, I
>expect.
Hmm... I created a virtual machine with 4 nodes, which has total 6
populated zones. All of them are different.
This is a little bit out of my expactation.
>
>I'll toss it in there for now, let's see who breaks :(
Thanks.
--
Wei Yang
Help you, Help me