diff options
author | Hugh Dickins <hugh.dickins@tiscali.co.uk> | 2009-09-21 20:02:12 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-09-22 10:17:32 -0400 |
commit | 26465d3ea5a62d59efb3796b9e0e2b0656d02cb1 (patch) | |
tree | 40644bae6d246a1ee0d38b98a5281a3a879725a1 | |
parent | 473b0ce4d13ee77925a7062e25dea0d16a91f654 (diff) |
ksm: break cow once unshared
We kept agreeing not to bother about the unswappable shared KSM pages
which later become unshared by others: observation suggests they're not
a significant proportion. But they are disadvantageous, and it is easier
to break COW to replace them by swappable pages, than offer statistics
to show that they don't matter; then we can stop worrying about them.
Doing this in ksm_do_scan, they don't go through cmp_and_merge_page on
this pass: give them a good chance of getting into the unstable tree
on the next pass, or back into the stable, by computing checksum now.
Signed-off-by: Hugh Dickins <hugh.dickins@tiscali.co.uk>
Acked-by: Izik Eidus <ieidus@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | mm/ksm.c | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -1268,6 +1268,14 @@ static void ksm_do_scan(unsigned int scan_npages) | |||
1268 | return; | 1268 | return; |
1269 | if (!PageKsm(page) || !in_stable_tree(rmap_item)) | 1269 | if (!PageKsm(page) || !in_stable_tree(rmap_item)) |
1270 | cmp_and_merge_page(page, rmap_item); | 1270 | cmp_and_merge_page(page, rmap_item); |
1271 | else if (page_mapcount(page) == 1) { | ||
1272 | /* | ||
1273 | * Replace now-unshared ksm page by ordinary page. | ||
1274 | */ | ||
1275 | break_cow(rmap_item->mm, rmap_item->address); | ||
1276 | remove_rmap_item_from_tree(rmap_item); | ||
1277 | rmap_item->oldchecksum = calc_checksum(page); | ||
1278 | } | ||
1271 | put_page(page); | 1279 | put_page(page); |
1272 | } | 1280 | } |
1273 | } | 1281 | } |