summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorCarsten Otte <cotte@de.ibm.com>2011-12-01 16:32:16 +0400
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2011-12-01 16:32:17 +0400
commit7c81878b34dd1b75dec5c8b68951d1439854d358 (patch)
treeb8b9ad4c00279d8fc0f0402704fc580b1cbc092c /arch
parentd9ae6772d3a3d7325d535577d9fd09c0de8a9da3 (diff)
downloadlinux-7c81878b34dd1b75dec5c8b68951d1439854d358.tar.xz
[S390] fix page change underindication in pgste_update_all
This patch makes sure we don't underindicate _PAGE_CHANGED in case we have a race between an operation that changes the page and this code path that hits us between page_get_storage_key and page_set_storage_key. Note that we still have a potential underindication on _PAGE_REFERENCED in the unlikely event that the page was changed but not referenced _and_ someone references the page in the race window. That's not considered to be a problem. Signed-off-by: Carsten Otte <cotte@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/s390/include/asm/pgtable.h8
1 files changed, 4 insertions, 4 deletions
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 524d23b8610c..4f289ff0b7fe 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -599,10 +599,10 @@ static inline pgste_t pgste_update_all(pte_t *ptep, pgste_t pgste)
skey = page_get_storage_key(address);
bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED);
/* Clear page changed & referenced bit in the storage key */
- if (bits) {
- skey ^= bits;
- page_set_storage_key(address, skey, 1);
- }
+ if (bits & _PAGE_CHANGED)
+ page_set_storage_key(address, skey ^ bits, 1);
+ else if (bits)
+ page_reset_referenced(address);
/* Transfer page changed & referenced bit to guest bits in pgste */
pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */
/* Get host changed & referenced bits from pgste */