Received: by 10.213.65.68 with SMTP id h4csp1191143imn; Wed, 21 Mar 2018 05:05:53 -0700 (PDT) X-Google-Smtp-Source: AG47ELspMhougPL70ue+xRe8hwetL2MDSMImos6agtFu0BKMlQxv36JfnCvH1V27rIsLIg18Yt9X X-Received: by 10.101.85.143 with SMTP id j15mr14437594pgs.387.1521633953362; Wed, 21 Mar 2018 05:05:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521633953; cv=none; d=google.com; s=arc-20160816; b=MqdJO0sbgdWXcYoxADL/p7rPiTGZfGUY0qa067D8yBx4FL9smTeLD7fMycFdxRaktJ XIgZ4waeckKwA324OwKWH9Rlwme8gQB+X1P8ioZpK4JxEq53a+/la4ixZarb/KdkgoSA vtiUG5i0ZsSvzZE5s0bBtYKwxl0/w3fv0LILv015q+OFIf6UFUiQjuJYMtOraP2DXUo8 7mC/gVFdv1d1LPCI2QsY0d1ZfmCOSHX+sgCMNBGvil2nG2RLl0XyEVNkeGNX8tX+qwRN yJxCkCPCttVooLOU6zTx0cFolyL4A0dGo1YopgGhqVr+avN5yCfQ12n5KqGQJY2jmCNL K92A== 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=bGMkFVp7VTZrlZVxjrCotgn4ZeeVAj3utT63571G0Ng=; b=naaH0mKOcgwOdAaByIX9J2WTZnlLY+WOcug5wDnjL9A4bEGy2OzX3YHjhY6pYlEW33 fWfgIZzRtmyAwwa2YDTyIzKlaU2XmZjOO7kCxi6cFNPj4H8GyWVrpp8EaKAGT8nfG3xP an2kz7qDoYnyixc85eFH/DVQ8PPZumO8SPMAaH3/VrBaFtUdCUWcR+sDMtlaJgwcglSm UuCHlngDGy8koVjF9gb3EWdLDijr7UpesSIdT7mOUoSZuoiP6MjeoQXd1Tx6XpXsFG/t Xxef/z8EEedLky7i+kem8CD0Se5EoYXlFJDWCkFotehWMFDm2FJDQL1wV3C5SY3Udw28 wuAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Z+7KPWPt; 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 r3-v6si3634984plb.666.2018.03.21.05.05.39; Wed, 21 Mar 2018 05:05:53 -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=Z+7KPWPt; 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 S1751736AbeCUMEq (ORCPT + 99 others); Wed, 21 Mar 2018 08:04:46 -0400 Received: from mail-io0-f193.google.com ([209.85.223.193]:38184 "EHLO mail-io0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751505AbeCUMEo (ORCPT ); Wed, 21 Mar 2018 08:04:44 -0400 Received: by mail-io0-f193.google.com with SMTP id b20so6348044iof.5 for ; Wed, 21 Mar 2018 05:04:44 -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=bGMkFVp7VTZrlZVxjrCotgn4ZeeVAj3utT63571G0Ng=; b=Z+7KPWPt5f7TKsysaauylWcnIcwiUK7xzvGT4UpSopp1PtTdVfExsmHHlU1Nj8SlI1 3joSVzwkdkVgICp8IoBs89AQOLgJzHmzI3vv0AIKtpJUD5F3OEHEeAx0WaUr9VtALklq RuomuD1QeR6Xzxe5rf2061uxlr7d1zwD9+qI3SHL+HglukSclcdlfe4nJKcjd58HuNP6 FAgKEJnT5xcV8ALklwSc/t0lZC9Y0P3Hxz262G5dS14Ty2xTkxAcnih5XxxMsEcp1wG/ L+sHqojvAD818Uq+DTdHlSbwQePcdBXgmBUquDZMbsXIcGM7VgfThMHIuFR9CuLDLVoB jaOw== 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=bGMkFVp7VTZrlZVxjrCotgn4ZeeVAj3utT63571G0Ng=; b=ra+HG6mmxMQ/Wl7DiWfI6o18Bl2zgQVXGx38W7lEGXrfKB/RURoyJrEOr2CbVfmu+O 99kk0ntqogEAd+0VzhM5WtF6V+J1FqrJSE6zdbpGHY2hH5+NYLNRmi0kaoOtyHFLSuKo PQpoZMjyHIiG8Y07Et/1d4rSrumrOfDbaR8A9MTOAr+XQT5AuSa2P1r21CkVVQLc1Myr aOUAcRFCP3UKRGoq+mchxiEr5TY9HUHN9R3oQRQ+CWJR9JjP0Bh60rllbu0AkHFW7Kk0 957SdEhSmAVFFNXG0JnhzR8ndjr2ltHkjyALR9/AxJAZrjHjhw5O81GWm3Ff84/dmDBs ueog== X-Gm-Message-State: AElRT7F20ADdJ/AIUZcEN4olf1+35EQbm7Qa+Re4aMdx5Hwa1nExZd4T otePj+lbcfBq1ZO7mhy2Vu8= X-Received: by 10.107.25.14 with SMTP id 14mr4907760ioz.127.1521633883917; Wed, 21 Mar 2018 05:04:43 -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 f124sm368931ioe.27.2018.03.21.05.04.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 21 Mar 2018 05:04:43 -0700 (PDT) Subject: Re: [PATCH 2/4] mm/memblock: introduce memblock_search_pfn_regions() 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-3-git-send-email-hejianet@gmail.com> From: Jia He Message-ID: Date: Wed, 21 Mar 2018 20:04:22 +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 Hi Daniel Thanks for the review On 3/21/2018 6:14 PM, Daniel Vacek Wrote: > On Wed, Mar 21, 2018 at 9:09 AM, Jia He wrote: >> This api is the preparation for further optimizing early_pfn_valid >> >> Signed-off-by: Jia He >> --- >> include/linux/memblock.h | 2 ++ >> mm/memblock.c | 12 ++++++++++++ >> 2 files changed, 14 insertions(+) >> >> diff --git a/include/linux/memblock.h b/include/linux/memblock.h >> index 9471db4..5f46956 100644 >> --- a/include/linux/memblock.h >> +++ b/include/linux/memblock.h >> @@ -203,6 +203,8 @@ void __next_mem_pfn_range(int *idx, int nid, unsigned long *out_start_pfn, >> i >= 0; __next_mem_pfn_range(&i, nid, p_start, p_end, p_nid)) >> #endif /* CONFIG_HAVE_MEMBLOCK_NODE_MAP */ >> >> +int memblock_search_pfn_regions(unsigned long pfn); >> + >> unsigned long memblock_next_valid_pfn(unsigned long pfn, int *last_idx); >> /** >> * for_each_free_mem_range - iterate through free memblock areas >> diff --git a/mm/memblock.c b/mm/memblock.c >> index a9e8da4..f50fe5b 100644 >> --- a/mm/memblock.c >> +++ b/mm/memblock.c >> @@ -1659,6 +1659,18 @@ static int __init_memblock memblock_search(struct memblock_type *type, phys_addr >> return -1; >> } >> >> +/* search memblock with the input pfn, return the region idx */ >> +int __init_memblock memblock_search_pfn_regions(unsigned long pfn) >> +{ >> + struct memblock_type *type = &memblock.memory; >> + int mid = memblock_search(type, PFN_PHYS(pfn)); >> + >> + if (mid == -1) >> + return -1; > Why this? Yes, it is redudant and can be removed. Thanks Cheers, Jia