Received: by 10.213.65.68 with SMTP id h4csp2074534imn; Mon, 2 Apr 2018 00:00:55 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/Gtoit03YFwPSbAnylhf1BfDY56nkqUyJoYk+RMIBcSQkNl2b87vNA2dak9LFQtX9y7Xkf X-Received: by 10.99.110.5 with SMTP id j5mr5660518pgc.246.1522652454975; Mon, 02 Apr 2018 00:00:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522652454; cv=none; d=google.com; s=arc-20160816; b=O9cnv9Rz1aJ1VhgMjMZxD59YfF9QN+klaZr7rgrS63gKaJ7hk+FhQMZHNfA3Sbmr9F ylC1vNjTfP9WT83RDKAokHLByhtJjGBCNcsTqYH0CSxkAaDc5cqv5ou3+nSUgzAaf8Zn Gm0bUMvh7MYAmGDczrxvPTpdnhXwtyjFeC4hrGeKJEPLk/W2JgUoSlIFmn9VQ5KMX2y6 QkCosWaj7WGaTcuonxf98EH2ichenyAs3ju2M885FIEXSc4L9g9yDZIi59tiQuGcrm6k Y6LtgY6RXlTeP+KhoDC2wukXmQD9IB4LXtP6JzT3cX7O+83M4w9E5ujQdt4IG0I+TYf9 TyYA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=RKI2IQbpxDPDcK7wi1aLjiHUj9jnZveHoIUZSay0lww=; b=pKC35n257jQB35xmV0i81c1KSZcn9jCVD3dvS6Vxluw+jGxTmeOP4GMf0Fp2BtptnN SsnE9HlniwI4Z+KTrgN4j+ERxr9gwt/4s4T2Jrvh7gUqisOldiE1xmkwYNg4NOtaVblX RTN86fHT6xQOKEDSXy02YpGH1EFURwhCoD0eFK0TiTrY/OkcvItl5qD72YvwQ5htAQTS DmFZFEbUfd67hc9kIdo2aCJbWBU2HhkhPt5rn0sZaM9TLKtupPIYPFM9/4HzI+Mqa5vU +7eZAM0PNj3qGXJ880wHc3EZhc6I0Fj5hYthPByipp9Kx69ADAb5EgwXXFpb2uuUij1b a/xw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hzJPeTRu; 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=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e5-v6si15485594plk.730.2018.04.02.00.00.41; Mon, 02 Apr 2018 00:00:54 -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=@linaro.org header.s=google header.b=hzJPeTRu; 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=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754324AbeDBG5q (ORCPT + 99 others); Mon, 2 Apr 2018 02:57:46 -0400 Received: from mail-io0-f194.google.com ([209.85.223.194]:44143 "EHLO mail-io0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754307AbeDBG5p (ORCPT ); Mon, 2 Apr 2018 02:57:45 -0400 Received: by mail-io0-f194.google.com with SMTP id d7so16905168ioc.11 for ; Sun, 01 Apr 2018 23:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=RKI2IQbpxDPDcK7wi1aLjiHUj9jnZveHoIUZSay0lww=; b=hzJPeTRuUuPlgPQCVdKkfpShIxI9MmnICR36pi4NId+6efFk48JUgP5ORg8jcWwFwL htXlWXTq9CCS6HnbkIo3xrUIYjZ41hgG6UEF1acg63WyioBVruHBnx5hoxP3ZUoz7pqn Wv9un51FMasHg9zWavoMShj+9SOrgOHtZWMEQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=RKI2IQbpxDPDcK7wi1aLjiHUj9jnZveHoIUZSay0lww=; b=WN10g7dQcOElAhPaMli10mlKV8o3SsNoGJ+GY4KeIaZXb0PqTewcYCyqK//xv8zUX+ ArmRh5nheXglbPhareNHMPgSsDreQ2Y0OnZPAIyXgicnIfcJKRxazfzaKLKlT3O8GsrW GQ1ufyTBSX0xpmOiVoxzHnwSdAboIpHOu+ltm3eWhgebAev5S3DJl6+rtNi02mxua9jZ qWAqGWfrzywm+tWoZUFNyypwK9J+lIy0adYWhS9KMJTvaYzCviQYgX4PVtA8qlrrsyB4 PWLZkmoNPQuMTwbmFoT5hcMYRGPo6lvof7OjSENqLFtloaKc4sZQG2tq+ScfBtFv4CzM K0wA== X-Gm-Message-State: AElRT7GWVJ+ek6r5t8ZHBZ8wFhLSgRt5GcvSTcSL2GB5BpDOoCwNkX1n NSqjClkO2gDACliKQ5JBkmmeklnIRMC4g7+ibAU6mw== X-Received: by 10.107.14.136 with SMTP id 130mr7151524ioo.170.1522652264394; Sun, 01 Apr 2018 23:57:44 -0700 (PDT) MIME-Version: 1.0 Received: by 10.107.187.67 with HTTP; Sun, 1 Apr 2018 23:57:44 -0700 (PDT) In-Reply-To: <1522636236-12625-4-git-send-email-hejianet@gmail.com> References: <1522636236-12625-1-git-send-email-hejianet@gmail.com> <1522636236-12625-4-git-send-email-hejianet@gmail.com> From: Ard Biesheuvel Date: Mon, 2 Apr 2018 08:57:44 +0200 Message-ID: Subject: Re: [PATCH v5 3/5] mm/memblock: introduce memblock_search_pfn_regions() To: Jia He Cc: Russell King , Catalin Marinas , Will Deacon , Mark Rutland , Andrew Morton , 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 , Linux Kernel Mailing List , Linux-MM , Jia He Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2 April 2018 at 04:30, Jia He wrote: > This api is the preparation for further optimizing early_pfn_valid > Please add more explanatation here of what it is you are doing and why. > Signed-off-by: Jia He > --- > include/linux/memblock.h | 2 ++ > mm/memblock.c | 9 +++++++++ > 2 files changed, 11 insertions(+) > > diff --git a/include/linux/memblock.h b/include/linux/memblock.h > index 0257aee..a0127b3 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); > + > /** > * for_each_free_mem_range - iterate through free memblock areas > * @i: u64 used as loop variable > diff --git a/mm/memblock.c b/mm/memblock.c > index ba7c878..0f4004c 100644 > --- a/mm/memblock.c > +++ b/mm/memblock.c > @@ -1617,6 +1617,15 @@ 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)); > + > + return mid; > +} > + > bool __init memblock_is_reserved(phys_addr_t addr) > { > return memblock_search(&memblock.reserved, addr) != -1; > -- > 2.7.4 >