On Tue, Nov 13, 2018 at 10:07:58AM +0100, Michal Hocko wrote: >On Tue 13-11-18 08:16:44, Wei Yang wrote: > >No, I believe we want all three of them. But reviewing >for_each_populated_zone users and explicit checks for present/managed >pages and unify them would be a step forward both a more optimal code >and more maintainable code. I haven't checked but >for_each_populated_zone would seem like a proper user for managed page >counter. But that really requires to review all current users. > To sync with your purpose, I searched the user of for_each_populated_zone() and replace it with a new loop for_each_managed_zone(). Here is a summary of what I have done. file used changed ---------------------------------------------- arch/s390/mm/page-states.c 1 1 kernel/power/snapshot.c 7 3 mm/highmem.c 1 1 mm/huge_memory.c 1 0 mm/khugepaged.c 1 1 mm/madvise.c 1 1 mm/page_alloc.c 8 8 mm/vmstat.c 5 5 The general idea to replace for_each_populated_zone() with for_each_populated_zone() is: * access zone->freelist * access zone pcp * access zone_page_state Is my understanding comply with what you want? >-- >Michal Hocko >SUSE Labs -- Wei Yang Help you, Help me