From mboxrd@z Thu Jan 1 00:00:00 1970 From: Baoquan He Subject: Re: [PATCH v2 17/17] memblock: use separate iterators for memory and reserved regions Date: Wed, 5 Aug 2020 17:29:48 +0800 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-Transfer-Encoding: 7bit Return-path: Content-Disposition: inline In-Reply-To: <20200802163601.8189-18-rppt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Sender: "iommu" To: Mike Rapoport Cc: Emil Renner Berthing , linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Peter Zijlstra , Benjamin Herrenschmidt , Dave Hansen , linux-mips-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Max Filippov , Paul Mackerras , sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-riscv-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Will Deacon , Stafford Horne , linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-c6x-dev-jPsnJVOj+W6hPH1hqNUYSQ@public.gmane.org, Yoshinori Sato , Michael Ellerman , x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Russell King , Mike Rapoport , clang-built-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, Ingo Molnar , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Catalin Marinas , uclinux-h8-devel-5NWGOfrQmneRv+LV9MX5uooqe+aC9MnS@public.gmane.org, linux-xtens List-Id: linux-arch.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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CE65C433DF for ; Wed, 5 Aug 2020 09:30:07 +0000 (UTC) Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C9BD20792 for ; Wed, 5 Aug 2020 09:30:07 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aUOxTUPp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C9BD20792 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=iommu-bounces@lists.linux-foundation.org Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id F138E877E7; Wed, 5 Aug 2020 09:30:06 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 58z5-aU9W-Du; Wed, 5 Aug 2020 09:30:06 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 398EB877D1; Wed, 5 Aug 2020 09:30:06 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 232E2C0051; Wed, 5 Aug 2020 09:30:06 +0000 (UTC) Received: from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133]) by lists.linuxfoundation.org (Postfix) with ESMTP id E1DD3C004C for ; Wed, 5 Aug 2020 09:30:04 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id C7FBE880A1 for ; Wed, 5 Aug 2020 09:30:04 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0EDuVgzdoHBm for ; Wed, 5 Aug 2020 09:30:04 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by hemlock.osuosl.org (Postfix) with ESMTPS id 2248C8739A for ; Wed, 5 Aug 2020 09:30:04 +0000 (UTC) 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 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-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 Cc: Emil Renner Berthing , linux-sh@vger.kernel.org, Peter Zijlstra , Benjamin Herrenschmidt , Dave Hansen , linux-mips@vger.kernel.org, Max Filippov , Paul Mackerras , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Will Deacon , Stafford Horne , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, Yoshinori Sato , Michael Ellerman , x86@kernel.org, Russell King , Mike Rapoport , clang-built-linux@googlegroups.com, Ingo Molnar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , uclinux-h8-devel@lists.sourceforge.jp, linux-xtensa@linux-xtensa.org, openrisc@lists.librecores.org, Borislav Petkov , Andy Lutomirski , Paul Walmsley , Thomas Gleixner , Hari Bathini , Michal Simek , linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Palmer Dabbelt , Andrew Morton , Christoph Hellwig X-BeenThere: iommu@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Development issues for Linux IOMMU support List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: iommu-bounces@lists.linux-foundation.org Sender: "iommu" 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 _______________________________________________ iommu mailing list iommu@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/iommu From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 09FC9C433DF for ; Wed, 5 Aug 2020 09:31:05 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id C8E172075A for ; Wed, 5 Aug 2020 09:31:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aUOxTUPp" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725868AbgHEJbB (ORCPT ); Wed, 5 Aug 2020 05:31:01 -0400 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120]:38795 "EHLO us-smtp-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728327AbgHEJaE (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-mips-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mips@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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 84A33C433E0 for ; Wed, 5 Aug 2020 09:30:21 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5575F2075A for ; Wed, 5 Aug 2020 09:30:21 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="hg6x8cX7"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aUOxTUPp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5575F2075A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=jT/BUr8R+ZEvyivtuRK5h1O8Kl2/N/NF1NiOva/z7g4=; b=hg6x8cX7XGvooXGfnGOgFN6Fc 8jJRbvvxSylF9uz0zoDvDyoWRnlS2/w7nVmjRDCejMPwBlCggmqs2lJNTjEBPfYDIj30GhWj+pRu4 YOmDZVcvhwAv5MnFpqU8uuC/lansOyvLiLDi99TwbM4PzfiZ6ZdEL3CHRmOUByHQ564YsDrA4o0IB 8LZxViF7Ms/4LCkpRvNLcfC2GgaLyo/6MyJg+/SGzC2Badn8JmZAgHx8xnj1/hGJRqfpIKalCpEYE /U44BmSsJWYcRAi6uUm+ICGZG3JDfJF2CD8hhcyrar/4/s63EJFgCelUOQVlwUzLFtAmQ1WI/ISru TGjukMm+w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3FkN-0001CX-2z; Wed, 05 Aug 2020 09:30:07 +0000 Received: from us-smtp-1.mimecast.com ([205.139.110.61] helo=us-smtp-delivery-1.mimecast.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3FkJ-0001AX-Gs for linux-riscv@lists.infradead.org; Wed, 05 Aug 2020 09:30:05 +0000 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 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-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200805_053003_651025_CD935155 X-CRM114-Status: GOOD ( 19.19 ) X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Emil Renner Berthing , linux-sh@vger.kernel.org, Peter Zijlstra , Benjamin Herrenschmidt , Dave Hansen , linux-mips@vger.kernel.org, Max Filippov , Paul Mackerras , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Will Deacon , Stafford Horne , Marek Szyprowski , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, Yoshinori Sato , Michael Ellerman , x86@kernel.org, Russell King , Mike Rapoport , clang-built-linux@googlegroups.com, Ingo Molnar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , uclinux-h8-devel@lists.sourceforge.jp, linux-xtensa@linux-xtensa.org, openrisc@lists.librecores.org, Borislav Petkov , Andy Lutomirski , Paul Walmsley , Thomas Gleixner , Hari Bathini , Michal Simek , linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Palmer Dabbelt , Andrew Morton , Christoph Hellwig Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv From mboxrd@z Thu Jan 1 00:00:00 1970 From: Baoquan He Date: Wed, 05 Aug 2020 09:29:48 +0000 Subject: Re: [PATCH v2 17/17] memblock: use separate iterators for memory and reserved regions Message-Id: <20200805092948.GX10792@MiWiFi-R3L-srv> List-Id: References: <20200802163601.8189-1-rppt@kernel.org> <20200802163601.8189-18-rppt@kernel.org> In-Reply-To: <20200802163601.8189-18-rppt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: Mike Rapoport Cc: Emil Renner Berthing , linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Peter Zijlstra , Benjamin Herrenschmidt , Dave Hansen , linux-mips-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, Max Filippov , Paul Mackerras , sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-riscv-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Will Deacon , Stafford Horne , linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-c6x-dev-jPsnJVOj+W6hPH1hqNUYSQ@public.gmane.org, Yoshinori Sato , Michael Ellerman , x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, Russell King , Mike Rapoport , clang-built-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org, Ingo Molnar , linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, Catalin Marinas , uclinux-h8-devel-5NWGOfrQmneRv+LV9MX5uooqe+aC9MnS@public.gmane.org, linux-xtens 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: Baoquan He Date: Wed, 5 Aug 2020 17:29:48 +0800 Subject: [OpenRISC] [PATCH v2 17/17] memblock: use separate iterators for memory and reserved regions In-Reply-To: <20200802163601.8189-18-rppt@kernel.org> References: <20200802163601.8189-1-rppt@kernel.org> <20200802163601.8189-18-rppt@kernel.org> Message-ID: <20200805092948.GX10792@MiWiFi-R3L-srv> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: openrisc@lists.librecores.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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.3 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 626A6C433DF for ; Wed, 5 Aug 2020 09:33:46 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 13C3E2075A for ; Wed, 5 Aug 2020 09:33:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aUOxTUPp"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aUOxTUPp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 13C3E2075A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 4BM5zD1Y0rzDqhF for ; Wed, 5 Aug 2020 19:33:44 +1000 (AEST) Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=redhat.com (client-ip=205.139.110.61; helo=us-smtp-delivery-1.mimecast.com; envelope-from=bhe@redhat.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: lists.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aUOxTUPp; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=aUOxTUPp; dkim-atps=neutral Received: from us-smtp-delivery-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 4BM5v16HmnzDqf9 for ; Wed, 5 Aug 2020 19:30:05 +1000 (AEST) 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= 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 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 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Emil Renner Berthing , linux-sh@vger.kernel.org, Peter Zijlstra , Dave Hansen , linux-mips@vger.kernel.org, Max Filippov , Paul Mackerras , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Will Deacon , Stafford Horne , Marek Szyprowski , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, Yoshinori Sato , x86@kernel.org, Russell King , Mike Rapoport , clang-built-linux@googlegroups.com, Ingo Molnar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , uclinux-h8-devel@lists.sourceforge.jp, linux-xtensa@linux-xtensa.org, openrisc@lists.librecores.org, Borislav Petkov , Andy Lutomirski , Paul Walmsley , Thomas Gleixner , Hari Bathini , Michal Simek , linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Palmer Dabbelt , Andrew Morton , Christoph Hellwig Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" 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 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-11.5 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0FBBEC433E1 for ; Wed, 5 Aug 2020 09:31:33 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D72362075A for ; Wed, 5 Aug 2020 09:31:32 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="wn0Q/g6p"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="aUOxTUPp" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D72362075A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=5RS7gdRXmgocnXpv/rY7YOenyxE6MCDpmzT0jUFq0Bw=; b=wn0Q/g6pvXxAjvVLL/rCCUmgz R3142n7gOBD13uXJFsjLr+36PCLjoaPSrCJzjkWFV+3oX9/Po7JBLr8h+UN/ogWG7nVumKbzI6FtH r1S1J7pRT87StY7inSdGWrWHrZFSPxB0yfLmpLpqO1dk++UekKt5/UJi3ETCt3FfC14WOrewxp3K9 q08sio0IcZOfaTQKcPXokL2OzB3/GqwwkBV/wdHitWWpxGFot+CbMGAq4ypAMN88AWCxtHL/BsKH0 wfwF9BJsACfqJDgSmtLJuJKIBqLfwQoSVOv2QBf96lRHdw/yyc6cEd66XBZOu/CAsokZdLowevJ22 q97+q/OAw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3FkO-0001Ck-9H; Wed, 05 Aug 2020 09:30:08 +0000 Received: from us-smtp-delivery-1.mimecast.com ([205.139.110.120] helo=us-smtp-1.mimecast.com) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1k3FkJ-0001Ae-JZ for linux-arm-kernel@lists.infradead.org; Wed, 05 Aug 2020 09:30:05 +0000 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 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-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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200805_053003_726394_7D0892B5 X-CRM114-Status: GOOD ( 20.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Emil Renner Berthing , linux-sh@vger.kernel.org, Peter Zijlstra , Benjamin Herrenschmidt , Dave Hansen , linux-mips@vger.kernel.org, Max Filippov , Paul Mackerras , sparclinux@vger.kernel.org, linux-riscv@lists.infradead.org, Will Deacon , Stafford Horne , Marek Szyprowski , linux-arch@vger.kernel.org, linux-s390@vger.kernel.org, linux-c6x-dev@linux-c6x.org, Yoshinori Sato , Michael Ellerman , x86@kernel.org, Russell King , Mike Rapoport , clang-built-linux@googlegroups.com, Ingo Molnar , linux-arm-kernel@lists.infradead.org, Catalin Marinas , uclinux-h8-devel@lists.sourceforge.jp, linux-xtensa@linux-xtensa.org, openrisc@lists.librecores.org, Borislav Petkov , Andy Lutomirski , Paul Walmsley , Thomas Gleixner , Hari Bathini , Michal Simek , linux-mm@kvack.org, linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org, iommu@lists.linux-foundation.org, Palmer Dabbelt , Andrew Morton , Christoph Hellwig Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel