Patchwork [RFC,v2,1/4] powerpc: Move the setting of rflags out of loop in __hash_page_huge

login
register
mail settings
Submitter Li Zhong
Date April 12, 2013, 2:16 a.m.
Message ID <1365733021-28912-2-git-send-email-zhong@linux.vnet.ibm.com>
Download mbox | patch
Permalink /patch/235955/
State Accepted, archived
Commit 2c3c0693d9cf06d7baf99cfdc10f9c4d40198c6b
Delegated to: Michael Ellerman
Headers show

Comments

Li Zhong - April 12, 2013, 2:16 a.m.
It seems that rflags don't get changed in  the repeating loop, so move
it out of the loop.

Signed-off-by: Li Zhong <zhong@linux.vnet.ibm.com>
---
 arch/powerpc/mm/hugetlbpage-hash64.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
Michael Ellerman - April 15, 2013, 6:32 a.m.
On Fri, Apr 12, 2013 at 10:16:57AM +0800, Li Zhong wrote:
> It seems that rflags don't get changed in  the repeating loop, so move
> it out of the loop.

You've also changed the way new_pte is handled on repeat, but I think
that's OK too.

cheers

> diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c
> index cecad34..edb4129 100644
> --- a/arch/powerpc/mm/hugetlbpage-hash64.c
> +++ b/arch/powerpc/mm/hugetlbpage-hash64.c
> @@ -87,10 +87,6 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
>  
>  		pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT;
>  
> -repeat:
> -		hpte_group = ((hash & htab_hash_mask) *
> -			      HPTES_PER_GROUP) & ~0x7UL;
> -
>  		/* clear HPTE slot informations in new PTE */
>  #ifdef CONFIG_PPC_64K_PAGES
>  		new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HPTE_SUB0;

ie. here new_pte was updated on repeat, but now it's not.

> @@ -101,6 +97,10 @@ repeat:
>  		rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
>  				      _PAGE_COHERENT | _PAGE_GUARDED));
>  
> +repeat:
> +		hpte_group = ((hash & htab_hash_mask) *
> +			      HPTES_PER_GROUP) & ~0x7UL;
> +
>  		/* Insert into the hash table, primary slot */
>  		slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0,
>  					  mmu_psize, ssize);
Li Zhong - April 15, 2013, 8:17 a.m.
On Mon, 2013-04-15 at 16:32 +1000, Michael Ellerman wrote:
> On Fri, Apr 12, 2013 at 10:16:57AM +0800, Li Zhong wrote:
> > It seems that rflags don't get changed in  the repeating loop, so move
> > it out of the loop.

> You've also changed the way new_pte is handled on repeat, but I think
> that's OK too.

OK, I'll add it in the description :)

Thanks, Zhong

> cheers
> 
> > diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c
> > index cecad34..edb4129 100644
> > --- a/arch/powerpc/mm/hugetlbpage-hash64.c
> > +++ b/arch/powerpc/mm/hugetlbpage-hash64.c
> > @@ -87,10 +87,6 @@ int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
> >  
> >  		pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT;
> >  
> > -repeat:
> > -		hpte_group = ((hash & htab_hash_mask) *
> > -			      HPTES_PER_GROUP) & ~0x7UL;
> > -
> >  		/* clear HPTE slot informations in new PTE */
> >  #ifdef CONFIG_PPC_64K_PAGES
> >  		new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HPTE_SUB0;
> 
> ie. here new_pte was updated on repeat, but now it's not.
> 
> > @@ -101,6 +97,10 @@ repeat:
> >  		rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
> >  				      _PAGE_COHERENT | _PAGE_GUARDED));
> >  
> > +repeat:
> > +		hpte_group = ((hash & htab_hash_mask) *
> > +			      HPTES_PER_GROUP) & ~0x7UL;
> > +
> >  		/* Insert into the hash table, primary slot */
> >  		slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0,
> >  					  mmu_psize, ssize);
>

Patch

diff --git a/arch/powerpc/mm/hugetlbpage-hash64.c b/arch/powerpc/mm/hugetlbpage-hash64.c
index cecad34..edb4129 100644
--- a/arch/powerpc/mm/hugetlbpage-hash64.c
+++ b/arch/powerpc/mm/hugetlbpage-hash64.c
@@ -87,10 +87,6 @@  int __hash_page_huge(unsigned long ea, unsigned long access, unsigned long vsid,
 
 		pa = pte_pfn(__pte(old_pte)) << PAGE_SHIFT;
 
-repeat:
-		hpte_group = ((hash & htab_hash_mask) *
-			      HPTES_PER_GROUP) & ~0x7UL;
-
 		/* clear HPTE slot informations in new PTE */
 #ifdef CONFIG_PPC_64K_PAGES
 		new_pte = (new_pte & ~_PAGE_HPTEFLAGS) | _PAGE_HPTE_SUB0;
@@ -101,6 +97,10 @@  repeat:
 		rflags |= (new_pte & (_PAGE_WRITETHRU | _PAGE_NO_CACHE |
 				      _PAGE_COHERENT | _PAGE_GUARDED));
 
+repeat:
+		hpte_group = ((hash & htab_hash_mask) *
+			      HPTES_PER_GROUP) & ~0x7UL;
+
 		/* Insert into the hash table, primary slot */
 		slot = ppc_md.hpte_insert(hpte_group, vpn, pa, rflags, 0,
 					  mmu_psize, ssize);