From: Martin Schwidefsky Date: Sun, 24 Jul 2011 08:47:59 +0000 (+0200) Subject: [S390] reference bit testing for unmapped pages X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=50a15981a1fac7e019ff7c3cba87531fb580f065;p=mv-sheeva.git [S390] reference bit testing for unmapped pages On x86 a page without a mapper is by definition not referenced / old. The s390 architecture keeps the reference bit in the storage key and the current code will check the storage key for page without a mapper. This leads to an interesting effect: the first time an s390 system needs to write pages to swap it only finds referenced pages. This causes a lot of pages to get added and written to the swap device. To avoid this behaviour change page_referenced to query the storage key only if there is a mapper of the page. Signed-off-by: Martin Schwidefsky --- diff --git a/mm/rmap.c b/mm/rmap.c index 2540a39eea4..9701574bb67 100644 --- a/mm/rmap.c +++ b/mm/rmap.c @@ -869,11 +869,11 @@ int page_referenced(struct page *page, vm_flags); if (we_locked) unlock_page(page); + + if (page_test_and_clear_young(page_to_pfn(page))) + referenced++; } out: - if (page_test_and_clear_young(page_to_pfn(page))) - referenced++; - return referenced; }