Skip to content

Commit 395e6aa

Browse files
author
Martin Schwidefsky
committed
s390/mm: try to avoid storage key operation in ptep_set_access_flags
The call to pgste_set_key in ptep_set_access_flags can be avoided if the old pte is found to be valid at the time the new access rights are set. The function that created the old, valid pte already completed the required storage key operation. Signed-off-by: Martin Schwidefsky <[email protected]>
1 parent 5da7667 commit 395e6aa

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

arch/s390/include/asm/pgtable.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1267,8 +1267,10 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma,
12671267
pte_t entry, int dirty)
12681268
{
12691269
pgste_t pgste;
1270+
pte_t oldpte;
12701271

1271-
if (pte_same(*ptep, entry))
1272+
oldpte = *ptep;
1273+
if (pte_same(oldpte, entry))
12721274
return 0;
12731275
if (mm_has_pgste(vma->vm_mm)) {
12741276
pgste = pgste_get_lock(ptep);
@@ -1278,7 +1280,8 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma,
12781280
ptep_flush_direct(vma->vm_mm, address, ptep);
12791281

12801282
if (mm_has_pgste(vma->vm_mm)) {
1281-
pgste_set_key(ptep, pgste, entry, vma->vm_mm);
1283+
if (pte_val(oldpte) & _PAGE_INVALID)
1284+
pgste_set_key(ptep, pgste, entry, vma->vm_mm);
12821285
pgste = pgste_set_pte(ptep, pgste, entry);
12831286
pgste_set_unlock(ptep, pgste);
12841287
} else

0 commit comments

Comments
 (0)