linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: Alexander Kuleshov <kuleshovmail@gmail.com>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>,
	Paul Mackerras <paulus@samba.org>,
	Anton Blanchard <anton@samba.org>,
	Scott Wood <scottwood@freescale.com>,
	Dan Williams <dan.j.williams@intel.com>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] powerpc/mm: use memblock_is_memory
Date: Mon, 12 Oct 2015 20:35:54 +1100	[thread overview]
Message-ID: <1444642554.31951.0.camel@ellerman.id.au> (raw)
In-Reply-To: <1444415430-25827-1-git-send-email-kuleshovmail@gmail.com>

On Sat, 2015-10-10 at 00:30 +0600, Alexander Kuleshov wrote:
> The <linux/memblock.h> provides memblock_is_memory() function that
> tries to find a given physical address in the memblock.memory.regions.
> Let's use this function instead of direct coding of the same functionality.

Are you sure it implements exactly the same logic?

> diff --git a/arch/powerpc/mm/mem.c b/arch/powerpc/mm/mem.c
> index 22d94c3..85b462b 100644
> --- a/arch/powerpc/mm/mem.c
> +++ b/arch/powerpc/mm/mem.c
> @@ -82,11 +82,9 @@ int page_is_ram(unsigned long pfn)
>  	return pfn < max_pfn;
>  #else
>  	unsigned long paddr = (pfn << PAGE_SHIFT);
> -	struct memblock_region *reg;
> 
> -	for_each_memblock(memory, reg)
> -		if (paddr >= reg->base && paddr < (reg->base + reg->size))
> -			return 1;
> +	if (memblock_is_memory(paddr))
> +		return 1;
>  	return 0;

Why not just return memblock_is_memory(paddr) ?

cheers

      reply	other threads:[~2015-10-12  9:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-09 18:30 [PATCH] powerpc/mm: use memblock_is_memory Alexander Kuleshov
2015-10-12  9:35 ` Michael Ellerman [this message]

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=1444642554.31951.0.camel@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=anton@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=dan.j.williams@intel.com \
    --cc=kuleshovmail@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=scottwood@freescale.com \
    /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).