Skip to content

Commit

Permalink
s390/mm: try to avoid storage key operation in ptep_set_access_flags
Browse files Browse the repository at this point in the history
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 <schwidefsky@de.ibm.com>
  • Loading branch information
Martin Schwidefsky committed Oct 14, 2015
1 parent 5da7667 commit 395e6aa
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions arch/s390/include/asm/pgtable.h
Original file line number Diff line number Diff line change
Expand Up @@ -1267,8 +1267,10 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma,
pte_t entry, int dirty)
{
pgste_t pgste;
pte_t oldpte;

if (pte_same(*ptep, entry))
oldpte = *ptep;
if (pte_same(oldpte, entry))
return 0;
if (mm_has_pgste(vma->vm_mm)) {
pgste = pgste_get_lock(ptep);
Expand All @@ -1278,7 +1280,8 @@ static inline int ptep_set_access_flags(struct vm_area_struct *vma,
ptep_flush_direct(vma->vm_mm, address, ptep);

if (mm_has_pgste(vma->vm_mm)) {
pgste_set_key(ptep, pgste, entry, vma->vm_mm);
if (pte_val(oldpte) & _PAGE_INVALID)
pgste_set_key(ptep, pgste, entry, vma->vm_mm);
pgste = pgste_set_pte(ptep, pgste, entry);
pgste_set_unlock(ptep, pgste);
} else
Expand Down

0 comments on commit 395e6aa

Please sign in to comment.