lkml.org 
[lkml]   [2018]   [Apr]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH v6 5/5] mm: page_alloc: reduce unnecessary binary search in early_pfn_valid()
    Date
    Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns
    where possible") optimized the loop in memmap_init_zone(). But there is
    still some room for improvement. E.g. in early_pfn_valid(), if pfn and
    pfn+1 are in the same memblock region, we can record the last returned
    memblock region index and check check pfn++ is still in the same region.

    Currently it only improve the performance on arm64 and will have no
    impact on other arches.

    For the performance improvement, after this set, I can see the time
    overhead of memmap_init() is reduced from 41313 us to 24345 us in my
    armv8a server(QDF2400 with 96G memory).

    Signed-off-by: Jia He <jia.he@hxt-semitech.com>
    ---
    include/linux/mmzone.h | 9 +++++++--
    1 file changed, 7 insertions(+), 2 deletions(-)

    diff --git a/include/linux/mmzone.h b/include/linux/mmzone.h
    index a517d43..516ffb49 100644
    --- a/include/linux/mmzone.h
    +++ b/include/linux/mmzone.h
    @@ -1271,11 +1271,16 @@ static inline int pfn_present(unsigned long pfn)
    #define pfn_to_nid(pfn) (0)
    #endif

    -#define early_pfn_valid(pfn) pfn_valid(pfn)
    #ifdef CONFIG_HAVE_ARCH_PFN_VALID
    extern ulong memblock_next_valid_pfn(ulong pfn);
    #define next_valid_pfn(pfn) memblock_next_valid_pfn(pfn)
    -#endif
    +
    +extern int pfn_valid_region(ulong pfn);
    +#define early_pfn_valid(pfn) pfn_valid_region(pfn)
    +#else
    +#define early_pfn_valid(pfn) pfn_valid(pfn)
    +#endif /*CONFIG_HAVE_ARCH_PFN_VALID*/
    +
    void sparse_init(void);
    #else
    #define sparse_init() do {} while (0)
    --
    2.7.4
    \
     
     \ /
      Last update: 2018-04-04 04:58    [W:4.124 / U:0.688 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site