Commit 7fec647d authored by Anton Blanchard's avatar Anton Blanchard

ppc64: dont need the hash table lock to check linux pte flags, also ptep is never

NULL now.
parent 8844c7f7
...@@ -847,9 +847,12 @@ int hash_page(unsigned long ea, unsigned long access) ...@@ -847,9 +847,12 @@ int hash_page(unsigned long ea, unsigned long access)
ptep = find_linux_pte(pgdir, ea); ptep = find_linux_pte(pgdir, ea);
/* If no pte found, send the problem up to do_page_fault */ /*
if ( ! ptep ) { * If no pte found or not present, send the problem up to
spin_unlock( &mm->page_table_lock ); * do_page_fault
*/
if (!ptep || !pte_present(*ptep)) {
spin_unlock(&mm->page_table_lock);
return 1; return 1;
} }
...@@ -857,19 +860,10 @@ int hash_page(unsigned long ea, unsigned long access) ...@@ -857,19 +860,10 @@ int hash_page(unsigned long ea, unsigned long access)
* Acquire the hash table lock to guarantee that the linux * Acquire the hash table lock to guarantee that the linux
* pte we fetch will not change * pte we fetch will not change
*/ */
spin_lock( &hash_table_lock ); spin_lock(&hash_table_lock);
old_pte = *ptep; old_pte = *ptep;
/* If the pte is not "present" (valid), send the problem
* up to do_page_fault.
*/
if ( ! pte_present( old_pte ) ) {
spin_unlock( &hash_table_lock );
spin_unlock( &mm->page_table_lock );
return 1;
}
/* At this point we have found a pte (which was present). /* At this point we have found a pte (which was present).
* The spinlocks prevent this status from changing * The spinlocks prevent this status from changing
* The hash_table_lock prevents the _PAGE_HASHPTE status * The hash_table_lock prevents the _PAGE_HASHPTE status
...@@ -958,8 +952,7 @@ int hash_page(unsigned long ea, unsigned long access) ...@@ -958,8 +952,7 @@ int hash_page(unsigned long ea, unsigned long access)
ppc_md.hpte_updatepp( slot, newpp, va ); ppc_md.hpte_updatepp( slot, newpp, va );
if ( !pte_same( old_pte, new_pte ) ) if ( !pte_same( old_pte, new_pte ) )
*ptep = new_pte; *ptep = new_pte;
} } else {
else {
/* HPTE is not for this pte */ /* HPTE is not for this pte */
pte_val(old_pte) &= ~_PAGE_HPTEFLAGS; pte_val(old_pte) &= ~_PAGE_HPTEFLAGS;
} }
...@@ -972,10 +965,10 @@ int hash_page(unsigned long ea, unsigned long access) ...@@ -972,10 +965,10 @@ int hash_page(unsigned long ea, unsigned long access)
* *
* Find an available HPTE slot * Find an available HPTE slot
*/ */
slot = ppc_md.hpte_selectslot( vpn ); slot = ppc_md.hpte_selectslot(vpn);
hash_ind = 0; hash_ind = 0;
if ( slot < 0 ) { if (slot < 0) {
slot = -slot; slot = -slot;
hash_ind = 1; hash_ind = 1;
} }
...@@ -983,7 +976,6 @@ int hash_page(unsigned long ea, unsigned long access) ...@@ -983,7 +976,6 @@ int hash_page(unsigned long ea, unsigned long access)
/* Set the physical address */ /* Set the physical address */
prpn = pte_val(old_pte) >> PTE_SHIFT; prpn = pte_val(old_pte) >> PTE_SHIFT;
if ( ptep ) {
/* Update the linux pte with the HPTE slot */ /* Update the linux pte with the HPTE slot */
pte_val(new_pte) &= ~_PAGE_HPTEFLAGS; pte_val(new_pte) &= ~_PAGE_HPTEFLAGS;
pte_val(new_pte) |= hash_ind << 15; pte_val(new_pte) |= hash_ind << 15;
...@@ -994,13 +986,12 @@ int hash_page(unsigned long ea, unsigned long access) ...@@ -994,13 +986,12 @@ int hash_page(unsigned long ea, unsigned long access)
* or the hash_table_lock (we hold both) * or the hash_table_lock (we hold both)
*/ */
*ptep = new_pte; *ptep = new_pte;
}
/* copy appropriate flags from linux pte */ /* copy appropriate flags from linux pte */
hpteflags = (pte_val(new_pte) & 0x1f8) | newpp; hpteflags = (pte_val(new_pte) & 0x1f8) | newpp;
/* Create the HPTE */ /* Create the HPTE */
ppc_md.hpte_create_valid( slot, vpn, prpn, hash_ind, ptep, hpteflags, 0 ); ppc_md.hpte_create_valid(slot, vpn, prpn, hash_ind, ptep, hpteflags, 0);
} }
...@@ -1008,10 +999,8 @@ int hash_page(unsigned long ea, unsigned long access) ...@@ -1008,10 +999,8 @@ int hash_page(unsigned long ea, unsigned long access)
rc = 0; rc = 0;
} }
spin_unlock( &hash_table_lock ); spin_unlock(&hash_table_lock);
if (ptep) spin_unlock(&mm->page_table_lock);
spin_unlock( &mm->page_table_lock );
return rc; return rc;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment