]> git.karo-electronics.de Git - linux-beck.git/commitdiff
s390/mm: try to avoid storage key operation in ptep_set_access_flags
authorMartin Schwidefsky <schwidefsky@de.ibm.com>
Tue, 29 Sep 2015 10:51:40 +0000 (12:51 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 14 Oct 2015 12:32:07 +0000 (14:32 +0200)
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>
arch/s390/include/asm/pgtable.h

index 4d7e2e94082e465b1ee723ea45a68a854b96a507..024f85f947aec50ea93c881e56a73ba3a5591d3c 100644 (file)
@@ -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);
@@ -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