Commit 3c2c126a authored by Martin Schwidefsky's avatar Martin Schwidefsky

s390/mm: remove unnecessary indirection with pgste_update_all

The first parameter of pgste_update_all is a pointer to a pte.
Simplify the code by passing the pte value.
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 9bfefde7
...@@ -680,15 +680,15 @@ static inline void pgste_set(pte_t *ptep, pgste_t pgste) ...@@ -680,15 +680,15 @@ static inline void pgste_set(pte_t *ptep, pgste_t pgste)
#endif #endif
} }
static inline pgste_t pgste_update_all(pte_t *ptep, pgste_t pgste, static inline pgste_t pgste_update_all(pte_t pte, pgste_t pgste,
struct mm_struct *mm) struct mm_struct *mm)
{ {
#ifdef CONFIG_PGSTE #ifdef CONFIG_PGSTE
unsigned long address, bits, skey; unsigned long address, bits, skey;
if (!mm_use_skey(mm) || pte_val(*ptep) & _PAGE_INVALID) if (!mm_use_skey(mm) || pte_val(pte) & _PAGE_INVALID)
return pgste; return pgste;
address = pte_val(*ptep) & PAGE_MASK; address = pte_val(pte) & PAGE_MASK;
skey = (unsigned long) page_get_storage_key(address); skey = (unsigned long) page_get_storage_key(address);
bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED);
/* Transfer page changed & referenced bit to guest bits in pgste */ /* Transfer page changed & referenced bit to guest bits in pgste */
...@@ -1067,7 +1067,7 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, ...@@ -1067,7 +1067,7 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
unsigned long addr, pte_t *ptep) unsigned long addr, pte_t *ptep)
{ {
pgste_t pgste; pgste_t pgste;
pte_t pte, oldpte; pte_t pte;
int young; int young;
if (mm_has_pgste(vma->vm_mm)) { if (mm_has_pgste(vma->vm_mm)) {
...@@ -1075,17 +1075,16 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma, ...@@ -1075,17 +1075,16 @@ static inline int ptep_test_and_clear_young(struct vm_area_struct *vma,
pgste = pgste_ipte_notify(vma->vm_mm, addr, ptep, pgste); pgste = pgste_ipte_notify(vma->vm_mm, addr, ptep, pgste);
} }
oldpte = pte = *ptep; pte = *ptep;
ptep_flush_direct(vma->vm_mm, addr, ptep); ptep_flush_direct(vma->vm_mm, addr, ptep);
young = pte_young(pte); young = pte_young(pte);
pte = pte_mkold(pte);
if (mm_has_pgste(vma->vm_mm)) { if (mm_has_pgste(vma->vm_mm)) {
pgste = pgste_update_all(&oldpte, pgste, vma->vm_mm); pgste = pgste_update_all(pte, pgste, vma->vm_mm);
pgste = pgste_set_pte(ptep, pgste, pte); pgste = pgste_set_pte(ptep, pgste, pte_mkold(pte));
pgste_set_unlock(ptep, pgste); pgste_set_unlock(ptep, pgste);
} else } else
*ptep = pte; *ptep = pte_mkold(pte);
return young; return young;
} }
...@@ -1127,7 +1126,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm, ...@@ -1127,7 +1126,7 @@ static inline pte_t ptep_get_and_clear(struct mm_struct *mm,
pte_val(*ptep) = _PAGE_INVALID; pte_val(*ptep) = _PAGE_INVALID;
if (mm_has_pgste(mm)) { if (mm_has_pgste(mm)) {
pgste = pgste_update_all(&pte, pgste, mm); pgste = pgste_update_all(pte, pgste, mm);
pgste_set_unlock(ptep, pgste); pgste_set_unlock(ptep, pgste);
} }
return pte; return pte;
...@@ -1150,7 +1149,7 @@ static inline pte_t ptep_modify_prot_start(struct mm_struct *mm, ...@@ -1150,7 +1149,7 @@ static inline pte_t ptep_modify_prot_start(struct mm_struct *mm,
ptep_flush_lazy(mm, address, ptep); ptep_flush_lazy(mm, address, ptep);
if (mm_has_pgste(mm)) { if (mm_has_pgste(mm)) {
pgste = pgste_update_all(&pte, pgste, mm); pgste = pgste_update_all(pte, pgste, mm);
pgste_set(ptep, pgste); pgste_set(ptep, pgste);
} }
return pte; return pte;
...@@ -1191,7 +1190,7 @@ static inline pte_t ptep_clear_flush(struct vm_area_struct *vma, ...@@ -1191,7 +1190,7 @@ static inline pte_t ptep_clear_flush(struct vm_area_struct *vma,
if ((pgste_val(pgste) & _PGSTE_GPS_USAGE_MASK) == if ((pgste_val(pgste) & _PGSTE_GPS_USAGE_MASK) ==
_PGSTE_GPS_USAGE_UNUSED) _PGSTE_GPS_USAGE_UNUSED)
pte_val(pte) |= _PAGE_UNUSED; pte_val(pte) |= _PAGE_UNUSED;
pgste = pgste_update_all(&pte, pgste, vma->vm_mm); pgste = pgste_update_all(pte, pgste, vma->vm_mm);
pgste_set_unlock(ptep, pgste); pgste_set_unlock(ptep, pgste);
} }
return pte; return pte;
...@@ -1223,7 +1222,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, ...@@ -1223,7 +1222,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm,
pte_val(*ptep) = _PAGE_INVALID; pte_val(*ptep) = _PAGE_INVALID;
if (!full && mm_has_pgste(mm)) { if (!full && mm_has_pgste(mm)) {
pgste = pgste_update_all(&pte, pgste, mm); pgste = pgste_update_all(pte, pgste, mm);
pgste_set_unlock(ptep, pgste); pgste_set_unlock(ptep, pgste);
} }
return pte; return pte;
......
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