aboutsummaryrefslogtreecommitdiffstats
path: root/mm
diff options
context:
space:
mode:
authorAndrew Morton <akpm@osdl.org>2004-06-20 04:53:55 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-06-20 04:53:55 -0700
commitdd254918f5f87ca577de8dc4b76ee0fabefe5967 (patch)
treea2b5407d0148b59f75c0a7f2205c97de36a1404c /mm
parent7d28f09f3619b96db32d7e1ba1043d6884507be7 (diff)
downloadhistory-dd254918f5f87ca577de8dc4b76ee0fabefe5967.tar.gz
[PATCH] swapoff: activate pages
People like to use swapoff/swapon as a way of restoring their VM to a predictable "preconditional" state. Problem is, swapoff leaves mapped anon/pagecache pages on the inactive list, so they immediately get swapped out again when swapspace becomes available. Let's move these pages onto the active list to the VM has to again decide whether to swap them out. Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm')
-rw-r--r--mm/swapfile.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/swapfile.c b/mm/swapfile.c
index 2eabfd19a50cf6..154d05795678d1 100644
--- a/mm/swapfile.c
+++ b/mm/swapfile.c
@@ -467,6 +467,13 @@ static unsigned long unuse_pmd(struct vm_area_struct * vma, pmd_t *dir,
if (unlikely(pte_same(*pte, swp_pte))) {
unuse_pte(vma, offset + address, pte, entry, page);
pte_unmap(pte);
+
+ /*
+ * Move the page to the active list so it is not
+ * immediately swapped out again after swapon.
+ */
+ activate_page(page);
+
/* add 1 since address may be 0 */
return 1 + offset + address;
}