Skip to content

Commit 14ea40e

Browse files
davidhildenbrandborntraeger
authored andcommitted
s390/mm: optimize reset_guest_reference_bit()
We already optimize get_guest_storage_key() to assume that if we don't have a PTE table and don't have a huge page mapped that the storage key is 0. Similarly, optimize reset_guest_reference_bit() to simply do nothing if there is no PTE table and no huge page mapped. Signed-off-by: David Hildenbrand <[email protected]> Reviewed-by: Claudio Imbrenda <[email protected]> Acked-by: Heiko Carstens <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Borntraeger <[email protected]>
1 parent 7cb7026 commit 14ea40e

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

arch/s390/mm/pgtable.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -901,13 +901,23 @@ int reset_guest_reference_bit(struct mm_struct *mm, unsigned long addr)
901901
pte_t *ptep;
902902
int cc = 0;
903903

904-
if (pmd_lookup(mm, addr, &pmdp))
904+
/*
905+
* If we don't have a PTE table and if there is no huge page mapped,
906+
* the storage key is 0 and there is nothing for us to do.
907+
*/
908+
switch (pmd_lookup(mm, addr, &pmdp)) {
909+
case -ENOENT:
910+
return 0;
911+
case 0:
912+
break;
913+
default:
905914
return -EFAULT;
915+
}
906916

907917
ptl = pmd_lock(mm, pmdp);
908918
if (!pmd_present(*pmdp)) {
909919
spin_unlock(ptl);
910-
return -EFAULT;
920+
return 0;
911921
}
912922

913923
if (pmd_large(*pmdp)) {

0 commit comments

Comments
 (0)