• Zi Yan's avatar
    mm: page_isolation: move has_unmovable_pages() to mm/page_isolation.c · b48d8a8e
    Zi Yan authored
    Patch series "Use pageblock_order for cma and alloc_contig_range alignment", v11.
    
    This patchset tries to remove the MAX_ORDER-1 alignment requirement for CMA
    and alloc_contig_range(). It prepares for my upcoming changes to make
    MAX_ORDER adjustable at boot time[1].
    
    The MAX_ORDER - 1 alignment requirement comes from that
    alloc_contig_range() isolates pageblocks to remove free memory from buddy
    allocator but isolating only a subset of pageblocks within a page spanning
    across multiple pageblocks causes free page accounting issues.  Isolated
    page might not be put into the right free list, since the code assumes the
    migratetype of the first pageblock as the whole free page migratetype. 
    This is based on the discussion at [2].
    
    To remove the requirement, this patchset:
    1. isolates pages at pageblock granularity instead of
       max(MAX_ORDER_NR_PAEGS, pageblock_nr_pages);
    2. splits free pages across the specified range or migrates in-use pages
       across the specified range then splits the freed page to avoid free page
       accounting issues (it happens when multiple pageblocks within a single page
       have different migratetypes);
    3. only checks unmovable pages within the range instead of MAX_ORDER - 1 aligned
       range during isolation to avoid alloc_contig_range() failure when pageblocks
       within a MAX_ORDER - 1 aligned range are allocated separately.
    4. returns pages not in the range as it did before.
    
    One optimization might come later:
    1. make MIGRATE_ISOLATE a separate bit to be able to restore the original
       migratetypes when isolation fails in the middle of the range.
    
    [1] https://lore.kernel.org/linux-mm/20210805190253.2795604-1-zi.yan@sent.com/
    [2] https://lore.kernel.org/linux-mm/d19fb078-cb9b-f60f-e310-fdeea1b947d2@redhat.com/
    
    
    This patch (of 6):
    
    has_unmovable_pages() is only used in mm/page_isolation.c.  Move it from
    mm/page_alloc.c and make it static.
    
    Link: https://lkml.kernel.org/r/20220425143118.2850746-2-zi.yan@sent.comSigned-off-by: default avatarZi Yan <ziy@nvidia.com>
    Reviewed-by: default avatarOscar Salvador <osalvador@suse.de>
    Reviewed-by: default avatarMike Rapoport <rppt@linux.ibm.com>
    Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
    Cc: Vlastimil Babka <vbabka@suse.cz>
    Cc: Mel Gorman <mgorman@techsingularity.net>
    Cc: Eric Ren <renzhengeek@gmail.com>
    Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
    Cc: Minchan Kim <minchan@kernel.org>
    Cc: kernel test robot <lkp@intel.com>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    b48d8a8e
page_alloc.c 264 KB