linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nathan Fontenot <nfont@linux.vnet.ibm.com>
To: Li Zhong <zhong@linux.vnet.ibm.com>, linuxppc-dev@lists.ozlabs.org
Cc: paulus@samba.org
Subject: Re: [PATCH 4/4] powerpc: start loop at section start of start in vmemmap_populated()
Date: Thu, 24 Jul 2014 10:13:14 -0500	[thread overview]
Message-ID: <53D1228A.3060204@linux.vnet.ibm.com> (raw)
In-Reply-To: <1402475019-19699-4-git-send-email-zhong@linux.vnet.ibm.com>

On 06/11/2014 03:23 AM, Li Zhong wrote:
> vmemmap_populated() checks whether the [start, start + page_size) has valid
> pfn numbers, to know whether a vmemmap mapping has been created that includes
> this range.
> 
> Some range before end might not be checked by this loop:
>   sec11start......start11..sec11end/sec12start..end....start12..sec12end
> as the above, for start11(section 11), it checks [sec11start, sec11end), and
> loop ends as the next start(start12) is bigger than end. However,
> [sec11end/sec12start, end) is not checked here.
> 
> So before the loop, adjust the start to be the start of the section, so we don't miss ranges like the above.
> 
> After we adjust start to be the start of the section, it also means it's
> aligned with vmemmap as of the sizeof struct page, so we could use
> page_to_pfn directly in the loop.
> 
> Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
> Cc: Nathan Fontenot <nfont@linux.vnet.ibm.com>

Acked-by: Nathan Fontenot <nfont@linux.vnet.ibm.com>

> ---
>  arch/powerpc/mm/init_64.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/powerpc/mm/init_64.c b/arch/powerpc/mm/init_64.c
> index 4963790..253b4b9 100644
> --- a/arch/powerpc/mm/init_64.c
> +++ b/arch/powerpc/mm/init_64.c
> @@ -175,9 +175,10 @@ static unsigned long __meminit vmemmap_section_start(unsigned long page)
>  static int __meminit vmemmap_populated(unsigned long start, int page_size)
>  {
>  	unsigned long end = start + page_size;
> +	start = (unsigned long)(pfn_to_page(vmemmap_section_start(start)));
>  
>  	for (; start < end; start += (PAGES_PER_SECTION * sizeof(struct page)))
> -		if (pfn_valid(vmemmap_section_start(start)))
> +		if (pfn_valid(page_to_pfn((struct page *)start)))
>  			return 1;
>  
>  	return 0;
> 

  reply	other threads:[~2014-07-24 15:13 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-11  8:23 [PATCH 1/4] powerpc: implement vmemmap_list_free() Li Zhong
2014-06-11  8:23 ` [PATCH 2/4] powerpc: implement vmemmap_remove_mapping() for BOOK3S Li Zhong
2014-07-24 15:12   ` Nathan Fontenot
2014-06-11  8:23 ` [PATCH 3/4] powerpc: implement vmemmap_free() Li Zhong
2014-07-24 15:12   ` Nathan Fontenot
2014-06-11  8:23 ` [PATCH 4/4] powerpc: start loop at section start of start in vmemmap_populated() Li Zhong
2014-07-24 15:13   ` Nathan Fontenot [this message]
2014-07-24 15:11 ` [PATCH 1/4] powerpc: implement vmemmap_list_free() Nathan Fontenot

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=53D1228A.3060204@linux.vnet.ibm.com \
    --to=nfont@linux.vnet.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=paulus@samba.org \
    --cc=zhong@linux.vnet.ibm.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).