aboutsummaryrefslogtreecommitdiffstats
path: root/mm/memory.c
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-06-21 20:15:11 -0400
committerLinus Torvalds <torvalds@ppc970.osdl.org>2005-06-21 21:46:21 -0400
commitd296e9cd02c92e576ecce5344026a4df4353cdb2 (patch)
tree76af62c5d2c16e89672f71f2f4c7a65aa36ff914 /mm/memory.c
parent08ef472937e918875a82fd350d3de138aac50414 (diff)
[PATCH] do_wp_page: cannot share file page
A small optimization to do_wp_page's check for whether to avoid copy by reusing the page already mapped. It can never share a cached file page, nor can it share a reserved page (often the empty zero page), so it's a waste of time to lock and unlock in those cases. Which nowadays can both be neatly excluded by a preliminary PageAnon test. Christoph has reported that a preliminary page_count test proved valuable for scalability here, but PageAnon covers more common cases all at once. Signed-off-by: Hugh Dickins <hugh@veritas.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r--mm/memory.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c
index b8846cf2358a..1c0a3db78a05 100644
--- a/mm/memory.c
+++ b/mm/memory.c
@@ -1239,7 +1239,7 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct * vma,
1239 } 1239 }
1240 old_page = pfn_to_page(pfn); 1240 old_page = pfn_to_page(pfn);
1241 1241
1242 if (!TestSetPageLocked(old_page)) { 1242 if (PageAnon(old_page) && !TestSetPageLocked(old_page)) {
1243 int reuse = can_share_swap_page(old_page); 1243 int reuse = can_share_swap_page(old_page);
1244 unlock_page(old_page); 1244 unlock_page(old_page);
1245 if (reuse) { 1245 if (reuse) {