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

[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>

authored by

Carsten Otte and committed by
Martin Schwidefsky
7c81878b d9ae6772

+4 -4
+4 -4
arch/s390/include/asm/pgtable.h
··· 599 599 skey = page_get_storage_key(address); 600 600 bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED); 601 601 /* Clear page changed & referenced bit in the storage key */ 602 - if (bits) { 603 - skey ^= bits; 604 - page_set_storage_key(address, skey, 1); 605 - } 602 + if (bits & _PAGE_CHANGED) 603 + page_set_storage_key(address, skey ^ bits, 1); 604 + else if (bits) 605 + page_reset_referenced(address); 606 606 /* Transfer page changed & referenced bit to guest bits in pgste */ 607 607 pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */ 608 608 /* Get host changed & referenced bits from pgste */