On Wed, Dec 19, 2018 at 10:51:10AM +0100, Michal Hocko wrote: >On Wed 19-12-18 04:46:56, Wei Yang wrote: >> Below is a brief call flow for __offline_pages() and >> alloc_contig_range(): >> >> __offline_pages()/alloc_contig_range() >> start_isolate_page_range() >> set_migratetype_isolate() >> drain_all_pages() >> drain_all_pages() >> >> Current logic is: isolate and drain pcp list for each pageblock and >> drain pcp list again. This is not necessary and we could just drain pcp >> list once after isolate this whole range. >> >> The reason is start_isolate_page_range() will set the migrate type of >> a range to MIGRATE_ISOLATE. After doing so, this range will never be >> allocated from Buddy, neither to a real user nor to pcp list. > >But it is important to note that those pages still can be allocated from >the pcp lists until we do drain_all_pages(). > >One thing that I really do not like about this patch (and I believe I >have mentioned that previously) that you rely on callers to do the right >thing. The proper fix would be to do the draining in >start_isolate_page_range and remove them from callers. Also what does Well, I don't really understand this meaning previously. So you prefer set_migratetype_isolate() do the drain instead of the caller (__offline_pages) do the drain. Is my understanding correct? >prevent start_isolate_page_range to work on multiple zones? At least >contiguous allocator can do that in principle. As the comment mentioned, in current implementation the range must be in one zone. > >So no I do not like this patch, it is not an improvement. >-- >Michal Hocko >SUSE Labs -- Wei Yang Help you, Help me