summaryrefslogtreecommitdiffstats
path: root/mm/page_alloc.c
diff options
context:
space:
mode:
authorPavel Tatashin <pasha.tatashin@oracle.com>2017-11-15 20:36:27 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-11-15 21:21:05 -0500
commitea1f5f3712afe895dfa4176ec87376b4a9ac23be (patch)
tree811aa064975f28525952d7d797f2d54452abf1b5 /mm/page_alloc.c
parentdf8ee578894ebb591c2995cce422e6189c8bb757 (diff)
mm: define memblock_virt_alloc_try_nid_raw
* A new variant of memblock_virt_alloc_* allocations: memblock_virt_alloc_try_nid_raw() - Does not zero the allocated memory - Does not panic if request cannot be satisfied * optimize early system hash allocations Clients can call alloc_large_system_hash() with flag: HASH_ZERO to specify that memory that was allocated for system hash needs to be zeroed, otherwise the memory does not need to be zeroed, and client will initialize it. If memory does not need to be zero'd, call the new memblock_virt_alloc_raw() interface, and thus improve the boot performance. * debug for raw alloctor When CONFIG_DEBUG_VM is enabled, this patch sets all the memory that is returned by memblock_virt_alloc_try_nid_raw() to ones to ensure that no places excpect zeroed memory. Link: http://lkml.kernel.org/r/20171013173214.27300-6-pasha.tatashin@oracle.com Signed-off-by: Pavel Tatashin <pasha.tatashin@oracle.com> Reviewed-by: Steven Sistare <steven.sistare@oracle.com> Reviewed-by: Daniel Jordan <daniel.m.jordan@oracle.com> Reviewed-by: Bob Picco <bob.picco@oracle.com> Tested-by: Bob Picco <bob.picco@oracle.com> Acked-by: Michal Hocko <mhocko@suse.com> Cc: Alexander Potapenko <glider@google.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Cc: Catalin Marinas <catalin.marinas@arm.com> Cc: Christian Borntraeger <borntraeger@de.ibm.com> Cc: David S. Miller <davem@davemloft.net> Cc: Dmitry Vyukov <dvyukov@google.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: "H. Peter Anvin" <hpa@zytor.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: Mark Rutland <mark.rutland@arm.com> Cc: Matthew Wilcox <willy@infradead.org> Cc: Mel Gorman <mgorman@techsingularity.net> Cc: Michal Hocko <mhocko@kernel.org> Cc: Sam Ravnborg <sam@ravnborg.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/page_alloc.c')
-rw-r--r--mm/page_alloc.c15
1 files changed, 7 insertions, 8 deletions
diff --git a/mm/page_alloc.c b/mm/page_alloc.c
index 4dee5082d3d7..805f30dd1c26 100644
--- a/mm/page_alloc.c
+++ b/mm/page_alloc.c
@@ -7313,18 +7313,17 @@ void *__init alloc_large_system_hash(const char *tablename,
7313 7313
7314 log2qty = ilog2(numentries); 7314 log2qty = ilog2(numentries);
7315 7315
7316 /*
7317 * memblock allocator returns zeroed memory already, so HASH_ZERO is
7318 * currently not used when HASH_EARLY is specified.
7319 */
7320 gfp_flags = (flags & HASH_ZERO) ? GFP_ATOMIC | __GFP_ZERO : GFP_ATOMIC; 7316 gfp_flags = (flags & HASH_ZERO) ? GFP_ATOMIC | __GFP_ZERO : GFP_ATOMIC;
7321 do { 7317 do {
7322 size = bucketsize << log2qty; 7318 size = bucketsize << log2qty;
7323 if (flags & HASH_EARLY) 7319 if (flags & HASH_EARLY) {
7324 table = memblock_virt_alloc_nopanic(size, 0); 7320 if (flags & HASH_ZERO)
7325 else if (hashdist) 7321 table = memblock_virt_alloc_nopanic(size, 0);
7322 else
7323 table = memblock_virt_alloc_raw(size, 0);
7324 } else if (hashdist) {
7326 table = __vmalloc(size, gfp_flags, PAGE_KERNEL); 7325 table = __vmalloc(size, gfp_flags, PAGE_KERNEL);
7327 else { 7326 } else {
7328 /* 7327 /*
7329 * If bucketsize is not a power-of-two, we may free 7328 * If bucketsize is not a power-of-two, we may free
7330 * some pages at the end of hash table which 7329 * some pages at the end of hash table which