lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu,  5 Apr 2018 01:04:38 -0700
From:   Jia He <>
To:     Russell King <>,
        Catalin Marinas <>,
        Will Deacon <>,
        Mark Rutland <>,
        Ard Biesheuvel <>,
        Andrew Morton <>,
        Michal Hocko <>
Cc:     Wei Yang <>,
        Kees Cook <>,
        Laura Abbott <>,
        Vladimir Murzin <>,
        Philip Derrin <>,
        AKASHI Takahiro <>,
        James Morse <>,
        Steve Capper <>,
        Pavel Tatashin <>,
        Gioh Kim <>,
        Vlastimil Babka <>, Mel Gorman <>,
        Johannes Weiner <>,
        Kemi Wang <>,
        Petr Tesarik <>,
        Andrey Ryabinin <>,
        Nikolay Borisov <>,
        Daniel Jordan <>,
        Daniel Vacek <>,
        Eugeniu Rosca <>,,,, Jia He <>,
        Jia He <>
Subject: [PATCH v7 5/5] mm: page_alloc: reduce unnecessary binary search in early_pfn_valid()

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 whether pfn++ is still in the same

Currently it only improve the performance on arm/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 <>
 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 eb56071..ab01bd3 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)
-#define early_pfn_valid(pfn)	pfn_valid(pfn)
 extern ulong memblock_next_valid_pfn(ulong pfn);
 #define next_valid_pfn(pfn)	memblock_next_valid_pfn(pfn)
+extern int pfn_valid_region(ulong pfn);
+#define early_pfn_valid(pfn)	pfn_valid_region(pfn)
+#define early_pfn_valid(pfn)    pfn_valid(pfn)
 void sparse_init(void);
 #define sparse_init()	do {} while (0)

Powered by blists - more mailing lists