Received: by 10.213.65.68 with SMTP id h4csp654512imn; Thu, 22 Mar 2018 05:55:06 -0700 (PDT) X-Google-Smtp-Source: AG47ELvc/m3DmYc7yVw03a6PuJ9kqpGB4lg/QElwVHqIjKk4wMAgUXNGcmV9CdxiEtlY3YteBRt9 X-Received: by 10.99.165.22 with SMTP id n22mr17723065pgf.53.1521723305995; Thu, 22 Mar 2018 05:55:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521723305; cv=none; d=google.com; s=arc-20160816; b=IMiGL7bV7ULWb6D7GKmsL3bHyDzes41xJWJWcZ5SJYYc1uD3qFBQxDDalO5GmVFLh4 NVGgi2KKKnzYwvLwdQoC7iWfljs+2cO9tQHsF9z+aLpoJLyPAfW8/VOYKxapc4rPOU+K /10sLCGdRVakIVBt0caJfvLj6pCZhe85WOYpGJTqlL5Jyi7WJstVopenkP4XcgmFs0E9 vA+LGDjBr1pDLtLeuFg9Sv3KlldDcd+TTBvSSoZCb1mk4NvRkWtcNQHPzD0ZsT+4YwgR KAHbYTqL0wTC53LdyWhA1hYXzqC0ApIIPbKCbvHnCQy7u20HtYkkLI0CIRlPTJbvab5C EEfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=AST8vpBL2oAs0lIfNkXVu0r94l94pdVTom+JwLLAqBA=; b=sCe5kcvSCSM4Rg524tfwHJk9w8vKUE/3Zx5jAOhUV7/RD0Cg6mZ6/w91BWjwIqrDRy gXEydHtdDe0nYBgYE76XIlD7E1pI6URheFmstzn/dunBrKTrrz6pjKA4l4N+CeozndAK chnp8KaXLIEa6KIDXrXP93w2CCy56yVq2IPHn+Ry5yeCkEPOgzi7GkRSTcnawy/wHTvz Ym/4zf/99A2cVe1GprX0iP3rFg8MVHeCYiJ9rhdoZ/LE0hEEqoRGyKfJhDmei/4+8PsB FsCGrA4qvGcLew5AcFOUc8eYtJIIQmeLwOVRrsw4g1PDMmkBx8On29dUwLmXszudWbu7 nXUw== 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 n3si4402160pgc.12.2018.03.22.05.54.51; Thu, 22 Mar 2018 05:55:05 -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 S1754779AbeCVMwR (ORCPT + 99 others); Thu, 22 Mar 2018 08:52:17 -0400 Received: from smtp1.de.adit-jv.com ([62.225.105.245]:44922 "EHLO smtp1.de.adit-jv.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754672AbeCVMwP (ORCPT ); Thu, 22 Mar 2018 08:52:15 -0400 Received: from localhost (smtp1.de.adit-jv.com [127.0.0.1]) by smtp1.de.adit-jv.com (Postfix) with ESMTP id 0FBEE3C0012; Thu, 22 Mar 2018 13:52:14 +0100 (CET) Received: from smtp1.de.adit-jv.com ([127.0.0.1]) by localhost (smtp1.de.adit-jv.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id PUZ3X3kUuXfD; Thu, 22 Mar 2018 13:52:08 +0100 (CET) Received: from HI2EXCH01.adit-jv.com (hi2exch01.adit-jv.com [10.72.92.24]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp1.de.adit-jv.com (Postfix) with ESMTPS id 06BC63C09A2; Thu, 22 Mar 2018 13:52:08 +0100 (CET) Received: from vmlxhi-102.adit-jv.com (10.72.93.184) by HI2EXCH01.adit-jv.com (10.72.92.24) with Microsoft SMTP Server (TLS) id 14.3.382.0; Thu, 22 Mar 2018 13:52:07 +0100 Date: Thu, 22 Mar 2018 13:52:04 +0100 From: Eugeniu Rosca To: Jia He CC: Daniel Vacek , Andrew Morton , Michal Hocko , Catalin Marinas , Mel Gorman , Will Deacon , Mark Rutland , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Pavel Tatashin , Daniel Jordan , AKASHI Takahiro , Gioh Kim , Steven Sistare , Vlastimil Babka , open list , , James Morse , Ard Biesheuvel , Steve Capper , , Greg Kroah-Hartman , Kate Stewart , Philippe Ombredanne , Johannes Weiner , Kemi Wang , Petr Tesarik , YASUAKI ISHIMATSU , Andrey Ryabinin , Nikolay Borisov , Jia He , Eugeniu Rosca Subject: Re: [PATCH 1/4] mm: page_alloc: reduce unnecessary binary search in memblock_next_valid_pfn() Message-ID: <20180322125204.GA8892@vmlxhi-102.adit-jv.com> References: <1521619796-3846-1-git-send-email-hejianet@gmail.com> <1521619796-3846-2-git-send-email-hejianet@gmail.com> <3f208ebe-572f-f2f6-003e-5a9cf49bb92f@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <3f208ebe-572f-f2f6-003e-5a9cf49bb92f@gmail.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Originating-IP: [10.72.93.184] Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 21, 2018 at 08:28:18PM +0800, Jia He wrote: > > > On 3/21/2018 6:14 PM, Daniel Vacek Wrote: > >On Wed, Mar 21, 2018 at 9:09 AM, Jia He wrote: > >>Commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns > >>where possible") optimized the loop in memmap_init_zone(). But there is > >>still some room for improvement. E.g. if pfn and pfn+1 are in the same > >>memblock region, we can simply pfn++ instead of doing the binary search > >>in memblock_next_valid_pfn. > >There is a revert-mm-page_alloc-skip-over-regions-of-invalid-pfns-where-possible.patch > >in -mm reverting b92df1de5d289c0b as it is fundamentally wrong by > >design causing system panics on some machines with rare but still > >valid mappings. Basically it skips valid pfns which are outside of > >usable memory ranges (outside of memblock memory regions). > Thanks for the infomation. > quote from you patch description: > >But given some specific memory mapping on x86_64 (or more generally > theoretically anywhere but on arm with CONFIG_HAVE_ARCH_PFN_VALID) > the > implementation also skips valid pfns which is plain wrong and causes > > 'kernel BUG at mm/page_alloc.c:1389!' > > Do you think memblock_next_valid_pfn can remain to be not reverted on arm64 > with CONFIG_HAVE_ARCH_PFN_VALID? Arm64 can benifit from this optimization. I confirm that the boot time of Rcar-H3 arm64 platform greatly benefits from v4.11-rc1 commit b92df1de5d28 ("mm: page_alloc: skip over regions of invalid pfns where possible"). The startup improvement is roughly ~140ms, which will be lost if the mentioned commit is reverted. For more details on my measurements, please see linux-next commit 283f1645e236 ("mm: page_alloc: skip over regions of invalid pfns on UMA"). Whichever way you decide to go forward (reimplement/fix b92df1de5d28 or create an _next_valid_pfn), I am willing to participate in testing your proposals on RCAR SoCs. TIA. Thanks, Eugeniu.