Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <schwidefsky@de.ibm.com>

+5 -2
+5 -2
arch/s390/include/asm/pgtable.h
··· 1267 1267 pte_t entry, int dirty) 1268 1268 { 1269 1269 pgste_t pgste; 1270 + pte_t oldpte; 1270 1271 1271 - if (pte_same(*ptep, entry)) 1272 + oldpte = *ptep; 1273 + if (pte_same(oldpte, entry)) 1272 1274 return 0; 1273 1275 if (mm_has_pgste(vma->vm_mm)) { 1274 1276 pgste = pgste_get_lock(ptep); ··· 1280 1278 ptep_flush_direct(vma->vm_mm, address, ptep); 1281 1279 1282 1280 if (mm_has_pgste(vma->vm_mm)) { 1283 - pgste_set_key(ptep, pgste, entry, vma->vm_mm); 1281 + if (pte_val(oldpte) & _PAGE_INVALID) 1282 + pgste_set_key(ptep, pgste, entry, vma->vm_mm); 1284 1283 pgste = pgste_set_pte(ptep, pgste, entry); 1285 1284 pgste_set_unlock(ptep, pgste); 1286 1285 } else