mm: page_remove_rmap comments on PageAnon
Add a comment to s390's page_test_dirty/page_clear_dirty/page_set_dirty dance in page_remove_rmap(): I was wrong to think the PageSwapCache test could be avoided, and would like a comment in there to remind me. And mention s390, to help us remember that this block is not really common. Also move down the "It would be tidy to reset PageAnon" comment: it does not belong to s390's block, and it would be unwise to reset PageAnon before we're done with testing it. Signed-off-by: Hugh Dickins <hugh@veritas.com> Acked-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
d0fd93781c
commit
16f8c5b2e6
1 changed files with 16 additions and 9 deletions
25
mm/rmap.c
25
mm/rmap.c
|
@ -658,6 +658,22 @@ void page_remove_rmap(struct page *page, struct vm_area_struct *vma)
|
||||||
BUG();
|
BUG();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Now that the last pte has gone, s390 must transfer dirty
|
||||||
|
* flag from storage key to struct page. We can usually skip
|
||||||
|
* this if the page is anon, so about to be freed; but perhaps
|
||||||
|
* 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);
|
||||||
|
set_page_dirty(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
mem_cgroup_uncharge_page(page);
|
||||||
|
__dec_zone_page_state(page,
|
||||||
|
PageAnon(page) ? NR_ANON_PAGES : NR_FILE_MAPPED);
|
||||||
/*
|
/*
|
||||||
* It would be tidy to reset the PageAnon mapping here,
|
* It would be tidy to reset the PageAnon mapping here,
|
||||||
* but that might overwrite a racing page_add_anon_rmap
|
* but that might overwrite a racing page_add_anon_rmap
|
||||||
|
@ -667,15 +683,6 @@ void page_remove_rmap(struct page *page, struct vm_area_struct *vma)
|
||||||
* Leaving it set also helps swapoff to reinstate ptes
|
* Leaving it set also helps swapoff to reinstate ptes
|
||||||
* faster for those pages still in swapcache.
|
* faster for those pages still in swapcache.
|
||||||
*/
|
*/
|
||||||
if ((!PageAnon(page) || PageSwapCache(page)) &&
|
|
||||||
page_test_dirty(page)) {
|
|
||||||
page_clear_dirty(page);
|
|
||||||
set_page_dirty(page);
|
|
||||||
}
|
|
||||||
mem_cgroup_uncharge_page(page);
|
|
||||||
|
|
||||||
__dec_zone_page_state(page,
|
|
||||||
PageAnon(page) ? NR_ANON_PAGES : NR_FILE_MAPPED);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue