From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE, SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C5EDC55191 for ; Sat, 25 Apr 2020 16:50:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 638DA206CD for ; Sat, 25 Apr 2020 16:50:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="coa+6oK4"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="IHfCSB7l" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 638DA206CD Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:In-Reply-To: Content-Type:MIME-Version:References:Message-ID:Subject:To:From:Date:Reply-To :Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=xirhgdVq84U1nSe7RXDkavVp4nIbuG7haJjgVpvgIoU=; b=coa+6oK4dQCzaE97wqc57k0gQ F6kyysVQToNDPXX0LEha0m+6s7cdnF/GM01ktb08RzEVKrUeJRxbUdwz4Pc4saugu3bZ4XW9x9/Xs oWT94OwpD5vc3bff8y30ZoCmRTieiDFHrOBu6V3fMSOCgxLz0ovqnW7FDdVuWj/9NW4ShPhKXB9H/ kFHdNYa1f/wdvbmSnqRFpoyjNNGqnE6Ko62GVybxxsc8h1t7EtWuz3J8mOOH0RbpI5NGiEn91Suaj woVtQF1ljqtwVD86ZMsav/QdPs5RBJWPGbpeWKtGo2qZfx++hcYOyBFdlgk7Ynv0YjA+UJHGyHMfw 9hiLQbsoA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jSO0L-0007t2-46; Sat, 25 Apr 2020 16:50:13 +0000 Received: from mail.kernel.org ([198.145.29.99]) by bombadil.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jSO0E-0006Xu-1o; Sat, 25 Apr 2020 16:50:07 +0000 Received: from kernel.org (unknown [77.127.79.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1798F206CD; Sat, 25 Apr 2020 16:49:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1587833404; bh=0Sl4Z11RVRGJbUzY+39FiW21eIIyUSJn8sRyWLPh1QE=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IHfCSB7lAtP8F/QOkzrMVovSds6GmLQXIYGNDyiWwar0dzDHihTkIxxJ4pzqN8dgI 7dZgKIyfVdwKPgmTvqMYetG92FlxubtA/kMLwHHTJZYJXQvWWxFhfOf1YllMgm6pNJ zD7n7cmGOJK81H7mitUpRubrKW286wNtPWLOyYuU= Date: Sat, 25 Apr 2020 19:49:47 +0300 From: Mike Rapoport To: David Hildenbrand Subject: Re: [PATCH 15/21] mm: memmap_init: iterate over memblock regions rather that check each PFN Message-ID: <20200425164947.GH14260@kernel.org> References: <20200412194859.12663-1-rppt@kernel.org> <20200412194859.12663-16-rppt@kernel.org> <9143538a-4aaa-ca1d-9c8f-72ac949cf593@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9143538a-4aaa-ca1d-9c8f-72ac949cf593@redhat.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200425_095006_149675_A05E7FA3 X-CRM114-Status: GOOD ( 18.68 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Rich Felker , linux-ia64@vger.kernel.org, linux-doc@vger.kernel.org, Catalin Marinas , Heiko Carstens , Michal Hocko , "James E.J. Bottomley" , Max Filippov , Guo Ren , linux-csky@vger.kernel.org, linux-parisc@vger.kernel.org, sparclinux@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-riscv@lists.infradead.org, Mike Rapoport , Greg Ungerer , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-snps-arc@lists.infradead.org, linux-c6x-dev@linux-c6x.org, Baoquan He , Jonathan Corbet , linux-sh@vger.kernel.org, Michael Ellerman , Helge Deller , x86@kernel.org, Russell King , Ley Foon Tan , Yoshinori Sato , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, Mark Salter , Matt Turner , linux-mips@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, linux-xtensa@linux-xtensa.org, linux-alpha@vger.kernel.org, linux-um@lists.infradead.org, linux-m68k@lists.linux-m68k.org, Tony Luck , Greentime Hu , Paul Walmsley , Stafford Horne , Guan Xuetao , Hoan Tran , Michal Simek , Thomas Bogendoerfer , Brian Cain , Nick Hu , linux-mm@kvack.org, Vineet Gupta , linux-kernel@vger.kernel.org, openrisc@lists.librecores.org, Richard Weinberger , Andrew Morton , linuxppc-dev@lists.ozlabs.org, "David S. Miller" Sender: "linux-riscv" Errors-To: linux-riscv-bounces+infradead-linux-riscv=archiver.kernel.org@lists.infradead.org On Fri, Apr 24, 2020 at 09:22:32AM +0200, David Hildenbrand wrote: > On 12.04.20 21:48, Mike Rapoport wrote: > > From: Baoquan He > > > > When called during boot the memmap_init_zone() function checks if each PFN > > is valid and actually belongs to the node being initialized using > > early_pfn_valid() and early_pfn_in_nid(). > > > > Each such check may cost up to O(log(n)) where n is the number of memory > > banks, so for large amount of memory overall time spent in early_pfn*() > > becomes substantial. > > > > Since the information is anyway present in memblock, we can iterate over > > memblock memory regions in memmap_init() and only call memmap_init_zone() > > for PFN ranges that are know to be valid and in the appropriate node. > > > > Signed-off-by: Baoquan He > > Signed-off-by: Mike Rapoport > > --- > > mm/page_alloc.c | 26 ++++++++++++++++---------- > > 1 file changed, 16 insertions(+), 10 deletions(-) > > > > diff --git a/mm/page_alloc.c b/mm/page_alloc.c > > index 7f6a3081edb8..c43ce8709457 100644 > > --- a/mm/page_alloc.c > > +++ b/mm/page_alloc.c > > @@ -5995,14 +5995,6 @@ void __meminit memmap_init_zone(unsigned long size, int nid, unsigned long zone, > > * function. They do not exist on hotplugged memory. > > */ > > After this change, the comment above is stale. the "holes in boot-time > mem_map" are handled by the caller now AFAIKs. Right, will update in v2. Thanks! > > if (context == MEMMAP_EARLY) { > > - if (!early_pfn_valid(pfn)) { > > - pfn = next_pfn(pfn); > > - continue; > > - } > > - if (!early_pfn_in_nid(pfn, nid)) { > > - pfn++; > > - continue; > > - } > > if (overlap_memmap_init(zone, &pfn)) > > continue; > > if (defer_init(nid, pfn, end_pfn)) > > > -- > Thanks, > > David / dhildenb > -- Sincerely yours, Mike.