Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp184486pxa; Tue, 4 Aug 2020 20:58:06 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJ0H9avEGlIIyokXVMaALsmWO13/oHx/Xc5PkHpMqHrwJ6KxGdT0rxaGopn63uIrdCi+Hy X-Received: by 2002:a17:906:7153:: with SMTP id z19mr1222299ejj.319.1596599886368; Tue, 04 Aug 2020 20:58:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596599886; cv=none; d=google.com; s=arc-20160816; b=BtaurCUqv4hVBXAD/BGSzA9Lw45j/xcNp7uT/5WLKMBFw0zNLW4Fg0sljuzSCSRVfV DREBEGXq3PDHRCH/D2pLRiITx5pLWVUJdNq31QWmy9NfOFGD3QWly929td4nLF2LeGPJ p6BJ9b+m5VZmxwQ82mGbABsjnA67szWrSLl4+mZb9Jt0DgIExMtuKFurFBsr2Js7b0uX U7JzHEJkS6oHSlAjCEvI7nOJjrwKz7jgz0kqRUCTfamNF5D+cjq3XV8ICyV/gZND6aib iz7UeXSTQElO0OT4/SqxkPcwSq4Vi5k3pm3vg/FrL2tPcVDHA83tGomERMS9wjQ2QB1B Oqxw== 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=TYHMWO+/kd/xb1BEqnZIo41jyaK7ZhQvyZqkmGc35KI=; b=aaB5vLlwfg3YBIlI7FYZ3Ho2RPvIYzWbVS3kKQg9Cru6W/xe/bptLhndFxDA/jje4+ 88GX/9vb3o5b0d/+Z7+r7RSrkD66OzKSD3lbyfBzS7t8D2l8MHrOThJ2JhZNufLfXJjI DnzRYKx3w5d/MsfwYhcEq8nyT1Uuz+Q7LT0S5XehkvKOEuOsfILBGVhLUb8vW14YpwM8 T9xu7fOhgzT1wBhv8zeydbcbGz+es+CsiqhWfAJKlfkiF0cth3ZpVcL2cL7lmJzHq1w0 0olyJ2JI2T5i32rRuS1B+nVYMMRkREYhjFwqKthmKQdw8frWGiWxUDsfbmrGtRUF78US iTuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Xr2voHUY; 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 dc15si517250ejb.285.2020.08.04.20.57.44; Tue, 04 Aug 2020 20:58:06 -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=Xr2voHUY; 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 S1726707AbgHED5c (ORCPT + 99 others); Tue, 4 Aug 2020 23:57:32 -0400 Received: from us-smtp-2.mimecast.com ([207.211.31.81]:46186 "EHLO us-smtp-delivery-1.mimecast.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725904AbgHED5b (ORCPT ); Tue, 4 Aug 2020 23:57:31 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1596599849; 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=TYHMWO+/kd/xb1BEqnZIo41jyaK7ZhQvyZqkmGc35KI=; b=Xr2voHUYkBjlVhxBLEFlUUZQkFLmFIMB9d+ScRmkNqp8Ban4KesCOdD6ZLMwI2DHfddeQL PFG6UFzzLTKW6Ye954Fd+rwM1ZVy1XRJXJBxCAEDlew3/IvEgIwYcK6ReAyzVz3ywuopXh GnPqhg0mlMnNU9x4elFXTWXxDJPlCEk= 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-301-qwjgBZnQPM-_Txp2UuCA1g-1; Tue, 04 Aug 2020 23:57:25 -0400 X-MC-Unique: qwjgBZnQPM-_Txp2UuCA1g-1 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7FD12800138; Wed, 5 Aug 2020 03:57:20 +0000 (UTC) Received: from localhost (ovpn-12-71.pek2.redhat.com [10.72.12.71]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B719C87B38; Wed, 5 Aug 2020 03:57:18 +0000 (UTC) Date: Wed, 5 Aug 2020 11:57:15 +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 11/17] arch, mm: replace for_each_memblock() with for_each_mem_pfn_range() Message-ID: <20200805035715.GS10792@MiWiFi-R3L-srv> References: <20200802163601.8189-1-rppt@kernel.org> <20200802163601.8189-12-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200802163601.8189-12-rppt@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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:35pm, Mike Rapoport wrote: > From: Mike Rapoport > > There are several occurrences of the following pattern: > > for_each_memblock(memory, reg) { > start_pfn = memblock_region_memory_base_pfn(reg); > end_pfn = memblock_region_memory_end_pfn(reg); > > /* do something with start_pfn and end_pfn */ > } > > Rather than iterate over all memblock.memory regions and each time query > for their start and end PFNs, use for_each_mem_pfn_range() iterator to get > simpler and clearer code. > > Signed-off-by: Mike Rapoport > --- > arch/arm/mm/init.c | 11 ++++------- > arch/arm64/mm/init.c | 11 ++++------- > arch/powerpc/kernel/fadump.c | 11 ++++++----- > arch/powerpc/mm/mem.c | 15 ++++++++------- > arch/powerpc/mm/numa.c | 7 ++----- > arch/s390/mm/page-states.c | 6 ++---- > arch/sh/mm/init.c | 9 +++------ > mm/memblock.c | 6 ++---- > mm/sparse.c | 10 ++++------ > 9 files changed, 35 insertions(+), 51 deletions(-) > Reviewed-by: Baoquan He