From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Hildenbrand Subject: Re: [PATCH 15/21] mm: memmap_init: iterate over memblock regions rather that check each PFN Date: Fri, 24 Apr 2020 09:22:32 +0200 Message-ID: <9143538a-4aaa-ca1d-9c8f-72ac949cf593@redhat.com> References: <20200412194859.12663-1-rppt@kernel.org> <20200412194859.12663-16-rppt@kernel.org> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date: Message-ID:From:References:To:Subject:Reply-To:Content-ID:Content-Description :Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=YeQse1ybr0gScYW8taf0X9S+V5iRwavfyXYfzFiJNI8=; b=WMDjKo/D0dY44X 7BqjqqfltnrSGf3m3Dq8NXmM39JXek0Tu55/tEsmWEQ0RQz3kIzyNxvFsaarohPXyHQ8lv7hEWkwg 5TEtDQAydiZysgDrwmUM9Kp5wZI+H6CyN82Ti0KXK2XWsFjTAdwmG4YzITWNdl4orECVIeHtf5PaZ R2Au0atA4rVydsZMd38uNKe/XGkmqDeWxlAa4KtzDQhHBCBTw+jlNW75d7sFNh9eLHKeytN+XwpSL f7au6kn/xB+Ax40rNphc7HcOa2p303ZkyqKp7dFK1d6gWDnjeRmsjttvjMwPFpeQsbEB1Ms+kLnCf SpDarqnhxyQVLN2SKQfw==; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1587712981; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:autocrypt:autocrypt; bh=mSCwKGFsRo1tURSlR3wqOWq4Aw66HvWN2vcc7P0apK8=; b=Txedu1JYK7SGF0/kgaxzqXoXsdlAANtJzqfDJOwKFG++GT93IEnJs1ssehPmsdXcvBMeoS 76HyNOVxUhcpMDvLcpqOjsZEAPEwJ/6GRMQc2kJGxkHJYP1d+VaPjyaAZNmyV8Ey89bulJ ja6AWqMLPO4vG/Nqc6uWKOVddiMFbqI= In-Reply-To: <20200412194859.12663-16-rppt@kernel.org> Content-Language: en-US List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-snps-arc" Errors-To: linux-snps-arc-bounces+gla-linux-snps-arc=m.gmane-mx.org@lists.infradead.org To: Mike Rapoport , linux-kernel@vger.kernel.org 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-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 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. > 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