aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/s390/char
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2012-11-07 07:17:37 -0500
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2013-02-14 09:55:23 -0500
commitabf09bed3cceadd809f0356065c2ada6cee90d4a (patch)
treeb81cac34a4111f498cdef104a2b9c4c444faf0bd /drivers/s390/char
parent486c0a0bc80d370471b21662bf03f04fbb37cdc6 (diff)
s390/mm: implement software dirty bits
The s390 architecture is unique in respect to dirty page detection, it uses the change bit in the per-page storage key to track page modifications. All other architectures track dirty bits by means of page table entries. This property of s390 has caused numerous problems in the past, e.g. see git commit ef5d437f71afdf4a "mm: fix XFS oops due to dirty pages without buffers on s390". To avoid future issues in regard to per-page dirty bits convert s390 to a fault based software dirty bit detection mechanism. All user page table entries which are marked as clean will be hardware read-only, even if the pte is supposed to be writable. A write by the user process will trigger a protection fault which will cause the user pte to be marked as dirty and the hardware read-only bit is removed. With this change the dirty bit in the storage key is irrelevant for Linux as a host, but the storage key is still required for KVM guests. The effect is that page_test_and_clear_dirty and the related code can be removed. The referenced bit in the storage key is still used by the page_test_and_clear_young primitive to provide page age information. For page cache pages of mappings with mapping_cap_account_dirty there will not be any change in behavior as the dirty bit tracking already uses read-only ptes to control the amount of dirty pages. Only for swap cache pages and pages of mappings without mapping_cap_account_dirty there can be additional protection faults. To avoid an excessive number of additional faults the mk_pte primitive checks for PageDirty if the pgprot value allows for writes and pre-dirties the pte. That avoids all additional faults for tmpfs and shmem pages until these pages are added to the swap cache. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/char')
-rw-r--r--drivers/s390/char/sclp_cmd.c10
1 files changed, 2 insertions, 8 deletions
diff --git a/drivers/s390/char/sclp_cmd.c b/drivers/s390/char/sclp_cmd.c
index c44d13f607bc..30a2255389e5 100644
--- a/drivers/s390/char/sclp_cmd.c
+++ b/drivers/s390/char/sclp_cmd.c
@@ -56,7 +56,6 @@ static int __initdata early_read_info_sccb_valid;
56 56
57u64 sclp_facilities; 57u64 sclp_facilities;
58static u8 sclp_fac84; 58static u8 sclp_fac84;
59static u8 sclp_fac85;
60static unsigned long long rzm; 59static unsigned long long rzm;
61static unsigned long long rnmax; 60static unsigned long long rnmax;
62 61
@@ -131,7 +130,8 @@ void __init sclp_facilities_detect(void)
131 sccb = &early_read_info_sccb; 130 sccb = &early_read_info_sccb;
132 sclp_facilities = sccb->facilities; 131 sclp_facilities = sccb->facilities;
133 sclp_fac84 = sccb->fac84; 132 sclp_fac84 = sccb->fac84;
134 sclp_fac85 = sccb->fac85; 133 if (sccb->fac85 & 0x02)
134 S390_lowcore.machine_flags |= MACHINE_FLAG_ESOP;
135 rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2; 135 rnmax = sccb->rnmax ? sccb->rnmax : sccb->rnmax2;
136 rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2; 136 rzm = sccb->rnsize ? sccb->rnsize : sccb->rnsize2;
137 rzm <<= 20; 137 rzm <<= 20;
@@ -171,12 +171,6 @@ unsigned long long sclp_get_rzm(void)
171 return rzm; 171 return rzm;
172} 172}
173 173
174u8 sclp_get_fac85(void)
175{
176 return sclp_fac85;
177}
178EXPORT_SYMBOL_GPL(sclp_get_fac85);
179
180/* 174/*
181 * This function will be called after sclp_facilities_detect(), which gets 175 * This function will be called after sclp_facilities_detect(), which gets
182 * called from early.c code. Therefore the sccb should have valid contents. 176 * called from early.c code. Therefore the sccb should have valid contents.