Received: by 10.213.65.68 with SMTP id h4csp1208712imn; Wed, 21 Mar 2018 05:30:27 -0700 (PDT) X-Google-Smtp-Source: AG47ELvOLmSzjJX4SJl+Cgm5mrxurGivenHykXGDjmVy/GEcVu2M17e4ZFDEt8+SH8/VjWV2sQh/ X-Received: by 2002:a17:902:6bc3:: with SMTP id m3-v6mr13498657plt.363.1521635426972; Wed, 21 Mar 2018 05:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521635426; cv=none; d=google.com; s=arc-20160816; b=DjwDuIPx5ajjZMPlVcI9u7PfKG45go/wGtdl+0M6UeNZj1kRp1NE2rL1mWbCGBuG2h WIvnPCLViIJlA9yqttUDFrd2xOpB4Z1y/RArOIxqTC+6rn7NyI3IZfAK5JwMBfTMo4QX OP6T871PRIZSuZverYMjDz4ac+F6LI8Gu/WnJC8FQ6rdeFUNEHwkefCllBVspdqQ162E zTC1lyzyU7iuoQmmwsG8O/BP1Yxy1xs4KvFYQnRgAgtP4Dmqbwpscy3dxlS+3nD/trfJ fESvzvfM/3wBPArwX7x4cvYOnPq5EGLFmz8i/Uyyxl7WVCCyEoRFXUCv8Rt5UjHUtMQE z3Yw== 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:in-reply-to :mime-version:user-agent:date:message-id:from:references:cc:to :subject:dkim-signature:arc-authentication-results; bh=Z0iOMD9i4edqrrmvhSsjQXG+p28W6hi/olcqmaI2gVw=; b=g77SPVWkA7RktrzPKsmJPhS5tYJdLzOPkBEwg75r4UaemvsW2YKtGVd6SXHpe6/a5z D5mVGL/ofxdRrvhmkk5NemrRYvXH4Tatp/jATIVmx4eAyQHGmX5cZxmKg9ug8NaJk9Cm o57DL5PAmbpRt5eOci5d2C9cNPOAA4L6by8g6T22WBKWJdMle2wZjPNu37RhV1/7FyCp QyyNmUpJ86C9tVq5Y1t9yAThLhFXk8p6J0SODFzo4GY4+X9kM3mC4eo63jwEgv3MmNug 4LKvHREFDXX5AyloVhCL0VD1OBy9nAUDZHQTSt+ww5dNsuhkcADXW40epWC6RIpe/GPJ rUFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QfgrlDWs; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r4-v6si3718353plo.128.2018.03.21.05.30.12; Wed, 21 Mar 2018 05:30:26 -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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=QfgrlDWs; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751940AbeCUM2q (ORCPT + 99 others); Wed, 21 Mar 2018 08:28:46 -0400 Received: from mail-it0-f66.google.com ([209.85.214.66]:53781 "EHLO mail-it0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751628AbeCUM2n (ORCPT ); Wed, 21 Mar 2018 08:28:43 -0400 Received: by mail-it0-f66.google.com with SMTP id b136-v6so6648204iti.3 for ; Wed, 21 Mar 2018 05:28:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=Z0iOMD9i4edqrrmvhSsjQXG+p28W6hi/olcqmaI2gVw=; b=QfgrlDWsGpaKNavDZGaRaF1oxOec7Xvk9AbSxJa5VQHmXUFDTviLnUxijXNyPgVbXV TtL7Olauvs5VASGg1FOJWlq+J3Xddi8Px2AtlnODexofT58KPAX1nYGXDUVxyo3Z8ket w+1PBJmIkpzGz4Vtxny6jXAuFEIBXjfqTNSZA3h7Zyk9NjVbWdNNTA069Fa1aHV27JjH CLy18vq+1MbYGXp84IzEdNaSIE5X2QBzpgf0M+beZEjZm+qwRz6DYXKQc+QFhpjBNa6b mgUEYINhFn79xatEh+ZQ1e2pfbIbsfrK0BXqtpHpHIgn3C46KRBlkYGpKKHnKpl9pQ1L IzyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=Z0iOMD9i4edqrrmvhSsjQXG+p28W6hi/olcqmaI2gVw=; b=NbiP7MGwRmVKKd0HKYlNU7AcfLXPEpVoEg+X9kaoYhAPgUVnkLD3BeUbfFRxvdQJ1v j9cwpb6dxRzU9cLt6YC2f/mQDjHG86/qO1R5Gnc3hQA2891GvggtEtQ43UksKnyfIh85 W6uba77R9adAsS84IPTs7sv/OwfCkrTxuUk/WsuXwKHGXilli5jIZjcWs2idPhhmzd8H wkdMYdKLy3kCsv/EQNhddad1PAHNBcKHyaZ9o4bzJGmMVIAnFFP/ccPcfEbAw5dyeeF7 UYsTxwUxwzWptbW3uiPXfXIAsakcp3lqEUPN0ssdM+ELOTIS0aMNmw9X2JPdje66dHOm APjg== X-Gm-Message-State: AElRT7GNiY8oiICf91cBhCOZpSV1V0WvLq8e5wDIZAMTLGHdrMBpWQxy A1kzzy1LzGq3J+CreHSbiRE= X-Received: by 2002:a24:c941:: with SMTP id h62-v6mr3928533itg.153.1521635322826; Wed, 21 Mar 2018 05:28:42 -0700 (PDT) Received: from [0.0.0.0] (67.216.217.169.16clouds.com. [67.216.217.169]) by smtp.gmail.com with ESMTPSA id i20sm3060224iod.36.2018.03.21.05.28.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 05:28:42 -0700 (PDT) Subject: Re: [PATCH 1/4] mm: page_alloc: reduce unnecessary binary search in memblock_next_valid_pfn() To: Daniel Vacek Cc: 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 , Eugeniu Rosca , Vlastimil Babka , open list , linux-mm@kvack.org, James Morse , Ard Biesheuvel , Steve Capper , x86@kernel.org, Greg Kroah-Hartman , Kate Stewart , Philippe Ombredanne , Johannes Weiner , Kemi Wang , Petr Tesarik , YASUAKI ISHIMATSU , Andrey Ryabinin , Nikolay Borisov , Jia He References: <1521619796-3846-1-git-send-email-hejianet@gmail.com> <1521619796-3846-2-git-send-email-hejianet@gmail.com> From: Jia He Message-ID: <3f208ebe-572f-f2f6-003e-5a9cf49bb92f@gmail.com> Date: Wed, 21 Mar 2018 20:28:18 +0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Cheers, Jia