From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753185AbdHKNFr (ORCPT ); Fri, 11 Aug 2017 09:05:47 -0400 Received: from mx2.suse.de ([195.135.220.15]:54756 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752779AbdHKNFq (ORCPT ); Fri, 11 Aug 2017 09:05:46 -0400 Date: Fri, 11 Aug 2017 15:05:42 +0200 From: Michal Hocko To: Pavel Tatashin Cc: linux-kernel@vger.kernel.org, sparclinux@vger.kernel.org, linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org, linux-arm-kernel@lists.infradead.org, x86@kernel.org, kasan-dev@googlegroups.com, borntraeger@de.ibm.com, heiko.carstens@de.ibm.com, davem@davemloft.net, willy@infradead.org, ard.biesheuvel@linaro.org, will.deacon@arm.com, catalin.marinas@arm.com, sam@ravnborg.org Subject: Re: [v6 14/15] mm: optimize early system hash allocations Message-ID: <20170811130541.GM30811@dhcp22.suse.cz> References: <1502138329-123460-1-git-send-email-pasha.tatashin@oracle.com> <1502138329-123460-15-git-send-email-pasha.tatashin@oracle.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1502138329-123460-15-git-send-email-pasha.tatashin@oracle.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 07-08-17 16:38:48, Pavel Tatashin wrote: > 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. > > Signed-off-by: Pavel Tatashin > Reviewed-by: Steven Sistare > Reviewed-by: Daniel Jordan > Reviewed-by: Bob Picco OK, but as mentioned in the previous patch add memblock_virt_alloc_raw in this patch. Acked-by: Michal Hocko > --- > mm/page_alloc.c | 15 +++++++-------- > 1 file changed, 7 insertions(+), 8 deletions(-) > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > index 4d32c1fa4c6c..000806298dfb 100644 > --- a/mm/page_alloc.c > +++ b/mm/page_alloc.c > @@ -7354,18 +7354,17 @@ void *__init alloc_large_system_hash(const char *tablename, > > log2qty = ilog2(numentries); > > - /* > - * memblock allocator returns zeroed memory already, so HASH_ZERO is > - * currently not used when HASH_EARLY is specified. > - */ > gfp_flags = (flags & HASH_ZERO) ? GFP_ATOMIC | __GFP_ZERO : GFP_ATOMIC; > do { > size = bucketsize << log2qty; > - if (flags & HASH_EARLY) > - table = memblock_virt_alloc_nopanic(size, 0); > - else if (hashdist) > + if (flags & HASH_EARLY) { > + if (flags & HASH_ZERO) > + table = memblock_virt_alloc_nopanic(size, 0); > + else > + table = memblock_virt_alloc_raw(size, 0); > + } else if (hashdist) { > table = __vmalloc(size, gfp_flags, PAGE_KERNEL); > - else { > + } else { > /* > * If bucketsize is not a power-of-two, we may free > * some pages at the end of hash table which > -- > 2.14.0 -- Michal Hocko SUSE Labs