Skip to content

Commit

Permalink
[S390] Optimize storage key handling for anonymous pages
Browse files Browse the repository at this point in the history
page_mkclean used to call page_clear_dirty for every given page. This
is different to all other architectures, where the dirty bit in the
PTEs is only resetted, if page_mapping() returns a non-NULL pointer.
We can move the page_test_dirty/page_clear_dirty sequence into the
2nd if to avoid unnecessary iske/sske sequences, which are expensive.

This change also helps kvm for s390 as the host must transfer the
dirty bit into the guest status bits. By moving the page_clear_dirty
operation into the 2nd if, the vm will only call page_clear_dirty
for pages where it walks the mapping anyway. There it calls
ptep_clear_flush for writable ptes, so we can transfer the dirty bit
to the guest.

Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
  • Loading branch information
Christian Borntraeger authored and Martin Schwidefsky committed Nov 20, 2007
1 parent b8e7a54 commit ce7e9fa
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions mm/rmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -471,11 +471,12 @@ int page_mkclean(struct page *page)

if (page_mapped(page)) {
struct address_space *mapping = page_mapping(page);
if (mapping)
if (mapping) {
ret = page_mkclean_file(mapping, page);
if (page_test_dirty(page)) {
page_clear_dirty(page);
ret = 1;
if (page_test_dirty(page)) {
page_clear_dirty(page);
ret = 1;
}
}
}

Expand Down

0 comments on commit ce7e9fa

Please sign in to comment.