• Wei Yang's avatar
    mm: remove extra drain pages on pcp list · c52e7593
    Wei Yang authored
    In the current implementation, there are two places to isolate a range
    of page: __offline_pages() and alloc_contig_range().  During this
    procedure, it will drain pages on pcp list.
    
    Below is a brief call flow:
    
      __offline_pages()/alloc_contig_range()
          start_isolate_page_range()
              set_migratetype_isolate()
                  drain_all_pages()
          drain_all_pages()                 <--- A
    
    This snippet shows the current logic is isolate and drain pcp list for
    each pageblock and drain pcp list again for the whole range.
    
    start_isolate_page_range is responsible for isolating the given pfn
    range.  One part of that job is to make sure that also pages that are on
    the allocator pcp lists are properly isolated.  Otherwise they could be
    reused and the range wouldn't be completely isolated until the memory is
    freed back.  While there is no strict guarantee here because pages might
    get allocated at any time before drain_all_pages is called there doesn't
    seem to be any strong demand for such a guarantee.
    
    In any case, draining is already done at the isolation level and there
    is no need to do it again later by start_isolate_page_range callers
    (memory hotplug and CMA allocator currently).  Therefore remove
    pointless draining in existing callers to make the code more clear and
    functionally correct.
    
    [mhocko@suse.com: provide a clearer changelog for the last two paragraphs]
    Link: http://lkml.kernel.org/r/20190105233141.2329-1-richard.weiyang@gmail.comSigned-off-by: default avatarWei Yang <richard.weiyang@gmail.com>
    Acked-by: default avatarMichal Hocko <mhocko@suse.com>
    Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
    Reviewed-by: default avatarOscar Salvador <osalvador@suse.de>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    c52e7593
page_alloc.c 231 KB