Skip to content
  • Alexander Duyck's avatar
    mm: initialize MAX_ORDER_NR_PAGES at a time instead of doing larger sections · 0e56acae
    Alexander Duyck authored
    Add yet another iterator, for_each_free_mem_range_in_zone_from, and then
    use it to support initializing and freeing pages in groups no larger than
    MAX_ORDER_NR_PAGES.  By doing this we can greatly improve the cache
    locality of the pages while we do several loops over them in the init and
    freeing process.
    
    We are able to tighten the loops further as a result of the "from"
    iterator as we can perform the initial checks for first_init_pfn in our
    first call to the iterator, and continue without the need for those checks
    via the "from" iterator.  I have added this functionality in the function
    called deferred_init_mem_pfn_range_in_zone that primes the iterator and
    causes us to exit if we encounter any failure.
    
    On my x86_64 test system with 384GB of memory per node I saw a reduction
    in initialization time from 1.85s to 1.38s as a result of this patch.
    
    Link: http://lkml.kernel.org/r/20190405221231.12227.85836.stgit@localhost.localdomain
    
    
    Signed-off-by: default avatarAlexander Duyck <alexander.h.duyck@linux.intel.com>
    Reviewed-by: default avatarPavel Tatashin <pasha.tatashin@soleen.com>
    Cc: Mike Rapoport <rppt@linux.ibm.com>
    Cc: Michal Hocko <mhocko@suse.com>
    Cc: Dave Jiang <dave.jiang@intel.com>
    Cc: Matthew Wilcox <willy@infradead.org>
    Cc: Ingo Molnar <mingo@kernel.org>
    Cc: <yi.z.zhang@linux.intel.com>
    Cc: Khalid Aziz <khalid.aziz@oracle.com>
    Cc: Mike Rapoport <rppt@linux.vnet.ibm.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Dan Williams <dan.j.williams@intel.com>
    Cc: Laurent Dufour <ldufour@linux.vnet.ibm.com>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: David S. Miller <davem@davemloft.net>
    Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
    Cc: Pavel Tatashin <pavel.tatashin@microsoft.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    0e56acae