Received: by 2002:ac0:a591:0:0:0:0:0 with SMTP id m17-v6csp132411imm; Fri, 6 Jul 2018 15:42:34 -0700 (PDT) X-Google-Smtp-Source: AAOMgpcZFL6UiEzsbdPiAOURiSG9k2qZ+qKGXszxTflmuazA2avwEJamow7QsbYOzaSn0hivXRqT X-Received: by 2002:a17:902:a716:: with SMTP id w22-v6mr11744826plq.271.1530916954845; Fri, 06 Jul 2018 15:42:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530916954; cv=none; d=google.com; s=arc-20160816; b=cc1XHJfkVhSEbaGcUdC6374/NravdlGr6ygLyZCDa/rdaFFbVXkHzny2p7ZXGcANMj 0RyE65mWxn8n9UeDOaebJUxwJMhNLf52Nw/qI0PHXkPAeRQoxp9CU8HBz6cP1zSGvWlj j8kJvrc1RXYMZ0iMu8LP9wPta/hE6fz/k5ASZdZZ+5TM9DSEja0ymlJ7YQTiucx3SciT mlwYTNswr5N4Vat1UCXjRMGo6x2vYieAQqMU8MAAcbBvFCk6GBKZgTqR9y112vLYRWx7 6sibtrE3zWrxP6e/5fuZjsRxABDZJv0sExXq/AkP0Bp0kalgzHkb9XtK76lKe/5udNK3 ShHQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:subject:cc:to:from:date :arc-authentication-results; bh=Eoq5HGti0nufimhymKHkJ3mwxECtZdhpvMi3auGea/g=; b=bhY/ugN1kOoBqU6q5d2Pxtz6ynaPvDvl9u7vv21VdeM4njr1HBF/qSqFhtVlMPcS2b Ed6CpsIlWq2fCOxPJXApKpIA57rXDnWUpiDDePJmbQ/TqOYlot0J1gnjdB81VWLA5bER HysVGjSbk4QjdBTCjIP0Wb99jR/LsU1OgbXvclP2GMd4ioMTvoc3Kkq4ty71QE/BtWPr 5b0+SuIso509PmN8dDcOMZOiAszt/1dYwJtoZOl0tEEpoDHGIX/2kdwaG6B7D8dAZw0a aQ82Vf+nfHb/G6/cWL83mwpA8xAxBE89uHKm+7UymCnYcNQyMr5xQku7NfbIWjTx30Z7 NYlw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x62-v6si10156096pfd.124.2018.07.06.15.42.20; Fri, 06 Jul 2018 15:42:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754337AbeGFWli (ORCPT + 99 others); Fri, 6 Jul 2018 18:41:38 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37800 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754124AbeGFWlh (ORCPT ); Fri, 6 Jul 2018 18:41:37 -0400 Received: from akpm3.svl.corp.google.com (unknown [104.133.9.92]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 86027DD5; Fri, 6 Jul 2018 22:41:36 +0000 (UTC) Date: Fri, 6 Jul 2018 15:41:35 -0700 From: Andrew Morton To: Jia He Cc: Russell King , Catalin Marinas , Will Deacon , Mark Rutland , Ard Biesheuvel , Michal Hocko , 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 , YASUAKI ISHIMATSU , Andrey Ryabinin , Nikolay Borisov , Daniel Jordan , Daniel Vacek , Eugeniu Rosca , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-mm@kvack.org Subject: Re: [RESEND PATCH v10 0/6] optimize memblock_next_valid_pfn and early_pfn_valid on arm and arm64 Message-Id: <20180706154135.1bbb6f4999f664a2ffadbc53@linux-foundation.org> In-Reply-To: <1530867675-9018-1-git-send-email-hejianet@gmail.com> References: <1530867675-9018-1-git-send-email-hejianet@gmail.com> X-Mailer: Sylpheed 3.6.0 (GTK+ 2.24.31; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 6 Jul 2018 17:01:09 +0800 Jia He wrote: > Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns > where possible") optimized the loop in memmap_init_zone(). But it causes > possible panic bug. So Daniel Vacek reverted it later. > > But as suggested by Daniel Vacek, it is fine to using memblock to skip > gaps and finding next valid frame with CONFIG_HAVE_ARCH_PFN_VALID. > > More from what Daniel said: > "On arm and arm64, memblock is used by default. But generic version of > pfn_valid() is based on mem sections and memblock_next_valid_pfn() does > not always return the next valid one but skips more resulting in some > valid frames to be skipped (as if they were invalid). And that's why > kernel was eventually crashing on some !arm machines." > > About the performance consideration: > As said by James in b92df1de5, > "I have tested this patch on a virtual model of a Samurai CPU with a > sparse memory map. The kernel boot time drops from 109 to 62 seconds." > Thus it would be better if we remain memblock_next_valid_pfn on arm/arm64. > > Besides we can remain memblock_next_valid_pfn, there is still some room > for improvement. After this set, I can see the time overhead of memmap_init > is reduced from 27956us to 13537us in my armv8a server(QDF2400 with 96G > memory, pagesize 64k). I believe arm server will benefit more if memory is > larger than TBs It's a shame that we're at v10, still with very little evidence of review activity. Oh well, it's a nice speedup. I'll toss it in and see what happens, but I'm not very familiar with memblock so we should try to find reviewers, please.