[S390] merge page_test_dirty and page_clear_dirty

The page_clear_dirty primitive always sets the default storage key
which resets the access control bits and the fetch protection bit.
That will surprise a KVM guest that sets non-zero access control
bits or the fetch protection bit. Merge page_test_dirty and
page_clear_dirty back to a single function and only clear the
dirty bit from the storage key.

In addition move the function page_test_and_clear_dirty and
page_test_and_clear_young to page.h where they belong. This
requires to change the parameter from a struct page * to a page
frame number.

Signed-off-by: Martin Schwidefsky <[email protected]>
This commit is contained in:
Martin Schwidefsky 2011-05-23 10:24:39 +02:00
commit 2d42552d1c
5 changed files with 68 additions and 71 deletions

View file

@ -719,7 +719,7 @@ int page_referenced(struct page *page,
unlock_page(page);
}
out:
if (page_test_and_clear_young(page))
if (page_test_and_clear_young(page_to_pfn(page)))
referenced++;
return referenced;
@ -785,10 +785,8 @@ int page_mkclean(struct page *page)
struct address_space *mapping = page_mapping(page);
if (mapping) {
ret = page_mkclean_file(mapping, page);
if (page_test_dirty(page)) {
page_clear_dirty(page, 1);
if (page_test_and_clear_dirty(page_to_pfn(page), 1))
ret = 1;
}
}
}
@ -981,10 +979,9 @@ void page_remove_rmap(struct page *page)
* not if it's in swapcache - there might be another pte slot
* containing the swap entry, but page not yet written to swap.
*/
if ((!PageAnon(page) || PageSwapCache(page)) && page_test_dirty(page)) {
page_clear_dirty(page, 1);
if ((!PageAnon(page) || PageSwapCache(page)) &&
page_test_and_clear_dirty(page_to_pfn(page), 1))
set_page_dirty(page);
}
/*
* Hugepages are not counted in NR_ANON_PAGES nor NR_FILE_MAPPED
* and not charged by memcg for now.