Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp340837pxa; Wed, 5 Aug 2020 02:31:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyzaDncA6fI+pvyUPQGSBSSSQsgKgA7nZOj45Iyh+PfJNlI9xuPkDfboXBOFBhSH2bfNJdG X-Received: by 2002:a17:906:a88b:: with SMTP id ha11mr2203133ejb.545.1596619912143; Wed, 05 Aug 2020 02:31:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596619912; cv=none; d=google.com; s=arc-20160816; b=WahRoenWzGCvstmpmkuStgiruNx5/Yclfeq845LHwVDPOzELq1u3Jsjnm/00LWkhBM ySBYYYPeAvyPrzq5Kn3BSTM2WkjH0nuDO7p1jcMCzZTW+Qo8oa2Eyq1rMuEZ+GLK9Qjp gVW+bXtGIgQsZO21yo/dIc1RkDbu39yj/NT2b4LprsIrf9Oh4sA+42qaGx4h7uyHHOz6 0B0MYD6pdAtt31IhhEfh7YoiL2fvp74dmaJy1g81hT1GUhoNMcVrMkkC0fNrpAagVPlJ tdj3FKZuJR/iCVNK6I6UOAE35hOovSstF9k+DEVcGLUgPagztyATryPpeXwZ6fI29FuB IcIg== 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:dkim-signature; bh=KGrNYVry5FOInRW/Xy0yFMiPNeyHmg20qhVD8oGfJJ4=; b=W4s+yDenl/AwzldfxmCVjTnemDYDkGaxpzAYXrkaJtPg4qtIAcPlM1CcON7vV3NmUQ HMsizQ3F2D9971jG5dLY3zYrIZ8kTrn2G3NaBx5d0YE5O8Rjxp1sSdHO3ePAWYBeDor5 4jEtgqnN15By5WdGlfv+s6fMVN0lborahiREKW8jubiw2+1ioEufTq4rgl4qmtj1Gz98 qqiqWIZFvypq1gCILgMH+21pmyIZA8b3N9Nw4UiooAe+FZGJJxBVp7KF8SMHhRE8ZF+3 U957oNZvgflZyS77NOvALEra89tTDqxHhzqUvXqYMOx8/2Ry1uioqbMeyjwkl4p+egFx oYDQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aUOxTUPp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id v19si1026286ejc.260.2020.08.05.02.31.29; Wed, 05 Aug 2020 02:31:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=aUOxTUPp; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728279AbgHEJbH (ORCPT + 99 others); Wed, 5 Aug 2020 05:31:07 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:48813 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728324AbgHEJaE (ORCPT ); Wed, 5 Aug 2020 05:30:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596619802; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=KGrNYVry5FOInRW/Xy0yFMiPNeyHmg20qhVD8oGfJJ4=; b=aUOxTUPpBPd48TQUNVSosUBrx0RpYWwrCSGKn8GWTGhB28sC3H1gVhK3g5jDWcq7hb1KLW HZC/Y/5rDZbbpdfxZ99aYgN5c7MepdlUlLdBcuzSbWncjo6uHbrkf+n4c9F1jMaqB2oSnv k3iBr7h6S4pqZcnEQhPLETOc35VuQnc= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-470-ZnwKN9E9NxSzYumJ2rNNrw-1; Wed, 05 Aug 2020 05:29:58 -0400 X-MC-Unique: ZnwKN9E9NxSzYumJ2rNNrw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 24BE680183C; Wed, 5 Aug 2020 09:29:53 +0000 (UTC) Received: from localhost (ovpn-12-71.pek2.redhat.com [10.72.12.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 068AF726A5; Wed, 5 Aug 2020 09:29:51 +0000 (UTC) Date: Wed, 5 Aug 2020 17:29:48 +0800 From: Baoquan He To: Mike Rapoport Cc: Andrew Morton , Andy Lutomirski , Benjamin Herrenschmidt , Borislav Petkov , Catalin Marinas , Christoph Hellwig , Dave Hansen , Emil Renner Berthing , Ingo Molnar , Hari Bathini , Marek Szyprowski , Max Filippov , Michael Ellerman , Michal Simek , Mike Rapoport , Palmer Dabbelt , Paul Mackerras , Paul Walmsley , Peter Zijlstra , Russell King , Stafford Horne , Thomas Gleixner , Will Deacon , Yoshinori Sato , clang-built-linux@googlegroups.com, iommu@lists.linux-foundation.org, linux-arch@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-c6x-dev@linux-c6x.org, linux-kernel@vger.kernel.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, linux-xtensa@linux-xtensa.org, linuxppc-dev@lists.ozlabs.org, openrisc@lists.librecores.org, sparclinux@vger.kernel.org, uclinux-h8-devel@lists.sourceforge.jp, x86@kernel.org Subject: Re: [PATCH v2 17/17] memblock: use separate iterators for memory and reserved regions Message-ID: <20200805092948.GX10792@MiWiFi-R3L-srv> References: <20200802163601.8189-1-rppt@kernel.org> <20200802163601.8189-18-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200802163601.8189-18-rppt@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 08/02/20 at 07:36pm, Mike Rapoport wrote: > From: Mike Rapoport > > for_each_memblock() is used to iterate over memblock.memory in > a few places that use data from memblock_region rather than the memory > ranges. > > Introduce separate for_each_mem_region() and for_each_reserved_mem_region() > to improve encapsulation of memblock internals from its users. > > Signed-off-by: Mike Rapoport > --- > .clang-format | 3 ++- > arch/arm64/kernel/setup.c | 2 +- > arch/arm64/mm/numa.c | 2 +- > arch/mips/netlogic/xlp/setup.c | 2 +- > arch/x86/mm/numa.c | 2 +- > include/linux/memblock.h | 19 ++++++++++++++++--- > mm/memblock.c | 4 ++-- > mm/page_alloc.c | 8 ++++---- > 8 files changed, 28 insertions(+), 14 deletions(-) > ... > diff --git a/include/linux/memblock.h b/include/linux/memblock.h > index 9e51b3fd4134..a6970e058bd7 100644 > --- a/include/linux/memblock.h > +++ b/include/linux/memblock.h > @@ -522,9 +522,22 @@ static inline unsigned long memblock_region_reserved_end_pfn(const struct memblo > return PFN_UP(reg->base + reg->size); > } > > -#define for_each_memblock(memblock_type, region) \ > - for (region = memblock.memblock_type.regions; \ > - region < (memblock.memblock_type.regions + memblock.memblock_type.cnt); \ > +/** > + * for_each_mem_region - itereate over registered memory regions ~~~~~~~~~~~~~~~~~ Wonder why emphasize 'registered' memory. Other than this confusion to me, this patch looks good. Reviewed-by: Baoquan He