linux-arch.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Baoquan He <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
To: Mike Rapoport <rppt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Emil Renner Berthing <kernel-sKpHZLTYfq0@public.gmane.org>,
	linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Peter Zijlstra <peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org>,
	Benjamin Herrenschmidt
	<benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org>,
	Dave Hansen <dave.hansen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>,
	linux-mips-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	Max Filippov <jcmvbkbc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	Paul Mackerras <paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org>,
	sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-riscv-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Will Deacon <will-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>,
	Stafford Horne <shorne-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-c6x-dev-jPsnJVOj+W6hPH1hqNUYSQ@public.gmane.org,
	Yoshinori Sato
	<ysato-Rn4VEauK+AKRv+LV9MX5uooqe+aC9MnS@public.gmane.org>,
	Michael Ellerman <mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org>,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	Russell King <linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org>,
	Mike Rapoport <rppt-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>,
	clang-built-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org,
	Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
	Catalin Marinas <catalin.marinas-5wv7dgnIgG8@public.gmane.org>,
	uclinux-h8-devel-5NWGOfrQmneRv+LV9MX5uooqe+aC9MnS@public.gmane.org,
	linux-xtens
Subject: Re: [PATCH v2 17/17] memblock: use separate iterators for memory and reserved regions
Date: Wed, 5 Aug 2020 17:29:48 +0800	[thread overview]
Message-ID: <20200805092948.GX10792@MiWiFi-R3L-srv> (raw)
In-Reply-To: <20200802163601.8189-18-rppt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>

On 08/02/20 at 07:36pm, Mike Rapoport wrote:
> From: Mike Rapoport <rppt-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>
> 
> 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 <rppt-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org>
> ---
>  .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 <bhe-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>

  parent reply	other threads:[~2020-08-05  9:29 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-02 16:35 [PATCH v2 00/17] memblock: seasonal cleaning^w cleanup Mike Rapoport
2020-08-02 16:35 ` [PATCH v2 01/17] KVM: PPC: Book3S HV: simplify kvm_cma_reserve() Mike Rapoport
2020-08-04 13:53   ` Daniel Axtens
2020-08-02 16:35 ` [PATCH v2 02/17] dma-contiguous: simplify cma_early_percent_memory() Mike Rapoport
2020-08-05  3:50   ` Baoquan He
2020-08-02 16:35 ` [PATCH v2 03/17] arm, xtensa: simplify initialization of high memory pages Mike Rapoport
2020-08-02 16:35 ` [PATCH v2 04/17] arm64: numa: simplify dummy_numa_init() Mike Rapoport
2020-08-02 16:35 ` [PATCH v2 05/17] h8300, nds32, openrisc: simplify detection of memory extents Mike Rapoport
2020-08-02 16:35 ` [PATCH v2 06/17] riscv: drop unneeded node initialization Mike Rapoport
2020-08-02 16:35 ` [PATCH v2 07/17] mircoblaze: drop unneeded NUMA and sparsemem initializations Mike Rapoport
2020-08-02 16:35 ` [PATCH v2 08/17] memblock: make for_each_memblock_type() iterator private Mike Rapoport
2020-08-02 16:35 ` [PATCH v2 09/17] memblock: make memblock_debug and related functionality private Mike Rapoport
2020-08-02 16:35 ` [PATCH v2 10/17] memblock: reduce number of parameters in for_each_mem_range() Mike Rapoport
2020-08-02 16:35 ` [PATCH v2 11/17] arch, mm: replace for_each_memblock() with for_each_mem_pfn_range() Mike Rapoport
2020-08-05  3:57   ` Baoquan He
2020-08-02 16:35 ` [PATCH v2 12/17] arch, drivers: replace for_each_membock() with for_each_mem_range() Mike Rapoport
2020-08-05 11:00   ` Thomas Bogendoerfer
2020-08-02 16:35 ` [PATCH v2 13/17] x86/setup: simplify initrd relocation and reservation Mike Rapoport
2020-08-02 18:01   ` Ingo Molnar
2020-08-05  4:20   ` Baoquan He
2020-08-05  5:59     ` Mike Rapoport
2020-08-05  5:59       ` Mike Rapoport
2020-08-02 16:35 ` [PATCH v2 14/17] x86/setup: simplify reserve_crashkernel() Mike Rapoport
2020-08-02 18:02   ` Ingo Molnar
2020-08-05  6:00   ` Baoquan He
2020-08-02 16:35 ` [PATCH v2 15/17] memblock: remove unused memblock_mem_size() Mike Rapoport
2020-08-05  8:29   ` Baoquan He
     [not found] ` <20200802163601.8189-1-rppt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2020-08-02 16:36   ` [PATCH v2 16/17] memblock: implement for_each_reserved_mem_region() using __next_mem_region() Mike Rapoport
2020-08-05  9:11     ` Baoquan He
2020-08-05 17:11     ` Miguel Ojeda
2020-08-02 16:36 ` [PATCH v2 17/17] memblock: use separate iterators for memory and reserved regions Mike Rapoport
2020-08-02 18:03   ` Ingo Molnar
     [not found]   ` <20200802163601.8189-18-rppt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
2020-08-05  9:29     ` Baoquan He [this message]
2020-08-05 10:58   ` Thomas Bogendoerfer
2020-08-05 17:10   ` Miguel Ojeda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200805092948.GX10792@MiWiFi-R3L-srv \
    --to=bhe-h+wxahxf7alqt0dzr+alfa@public.gmane.org \
    --cc=benh-XVmvHMARGAS8U2dJNN8I7kB+6BGkLq7r@public.gmane.org \
    --cc=catalin.marinas-5wv7dgnIgG8@public.gmane.org \
    --cc=clang-built-linux-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    --cc=dave.hansen-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \
    --cc=jcmvbkbc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=kernel-sKpHZLTYfq0@public.gmane.org \
    --cc=linux-I+IVW8TIWO2tmTQ+vhA3Yw@public.gmane.org \
    --cc=linux-arch-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-c6x-dev-jPsnJVOj+W6hPH1hqNUYSQ@public.gmane.org \
    --cc=linux-mips-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-riscv-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=linux-s390-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-sh-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=mpe-Gsx/Oe8HsFggBc27wqDAHg@public.gmane.org \
    --cc=paulus-eUNUBHrolfbYtjvyW6yDsg@public.gmane.org \
    --cc=peterz-wEGCiKHe2LqWVfeAwA7xHQ@public.gmane.org \
    --cc=rppt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=rppt-tEXmvtCZX7AybS5Ee8rs3A@public.gmane.org \
    --cc=shorne-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=sparclinux-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=uclinux-h8-devel-5NWGOfrQmneRv+LV9MX5uooqe+aC9MnS@public.gmane.org \
    --cc=will-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=ysato-Rn4VEauK+AKRv+LV9MX5uooqe+aC9MnS@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).