summaryrefslogtreecommitdiff
path: root/mm/ksm.c
diff options
context:
space:
mode:
authorMinchan Kim <minchan@kernel.org>2013-05-09 16:21:27 +0900
committerKyle Yan <kyan@codeaurora.org>2016-06-22 14:43:57 -0700
commit06de050ac6a250930f5b95dc153744d64dbc13c4 (patch)
tree7d78780c17783725e3699e0a414160ce52dcd500 /mm/ksm.c
parenta4e92011d44d60ad33dca31785682ddb82c44e40 (diff)
mm: Enhance per process reclaim to consider shared pages
Some pages could be shared by several processes. (ex, libc) In case of that, it's too bad to reclaim them from the beginnig. This patch causes VM to keep them on memory until last task try to reclaim them so shared pages will be reclaimed only if all of task has gone swapping out. This feature doesn't handle non-linear mapping on ramfs because it's very time-consuming and doesn't make sure of reclaiming and not common. Change-Id: I7e5f34f2e947f5db6d405867fe2ad34863ca40f7 Signed-off-by: Sangseok Lee <sangseok.lee@lge.com> Signed-off-by: Minchan Kim <minchan@kernel.org> Patch-mainline: linux-mm @ 9 May 2013 16:21:27 [vinmenon@codeaurora.org: trivial merge conflict fixes + changes to make the patch work with 3.18 kernel] Signed-off-by: Vinayak Menon <vinmenon@codeaurora.org>
Diffstat (limited to 'mm/ksm.c')
-rw-r--r--mm/ksm.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/mm/ksm.c b/mm/ksm.c
index 1a32a8feced8..56f5086de8a6 100644
--- a/mm/ksm.c
+++ b/mm/ksm.c
@@ -1984,6 +1984,12 @@ int rmap_walk_ksm(struct page *page, struct rmap_walk_control *rwc)
stable_node = page_stable_node(page);
if (!stable_node)
return ret;
+
+ if (rwc->target_vma) {
+ unsigned long address = vma_address(page, rwc->target_vma);
+ ret = rwc->rmap_one(page, rwc->target_vma, address, rwc->arg);
+ goto out;
+ }
again:
hlist_for_each_entry(rmap_item, &stable_node->hlist, hlist) {
struct anon_vma *anon_vma = rmap_item->anon_vma;