diff options
author | Christoph Lameter <clameter@sgi.com> | 2006-02-01 06:05:36 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 11:53:16 -0500 |
commit | b16664e44c54525be89dc07ad15a13b4eeec5634 (patch) | |
tree | 1844d193009c1e55e3c26256feb14bc622ec9af3 /mm/shmem.c | |
parent | 2a16e3f4b0c408b9e50297d2ec27e295d490267a (diff) |
[PATCH] Direct Migration V9: PageSwapCache checks
Check for PageSwapCache after looking up and locking a swap page.
The page migration code may change a swap pte to point to a different page
under lock_page().
If that happens then the vm must retry the lookup operation in the swap space
to find the correct page number. There are a couple of locations in the VM
where a lock_page() is done on a swap page. In these locations we need to
check afterwards if the page was migrated. If the page was migrated then the
old page that was looked up before was freed and no longer has the
PageSwapCache bit set.
Signed-off-by: Hirokazu Takahashi <taka@valinux.co.jp>
Signed-off-by: Dave Hansen <haveblue@us.ibm.com>
Signed-off-by: Christoph Lameter <clameter@@sgi.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'mm/shmem.c')
-rw-r--r-- | mm/shmem.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/mm/shmem.c b/mm/shmem.c index ce501bce1c2e..f7ac7b812f92 100644 --- a/mm/shmem.c +++ b/mm/shmem.c | |||
@@ -1028,6 +1028,14 @@ repeat: | |||
1028 | page_cache_release(swappage); | 1028 | page_cache_release(swappage); |
1029 | goto repeat; | 1029 | goto repeat; |
1030 | } | 1030 | } |
1031 | if (!PageSwapCache(swappage)) { | ||
1032 | /* Page migration has occured */ | ||
1033 | shmem_swp_unmap(entry); | ||
1034 | spin_unlock(&info->lock); | ||
1035 | unlock_page(swappage); | ||
1036 | page_cache_release(swappage); | ||
1037 | goto repeat; | ||
1038 | } | ||
1031 | if (PageWriteback(swappage)) { | 1039 | if (PageWriteback(swappage)) { |
1032 | shmem_swp_unmap(entry); | 1040 | shmem_swp_unmap(entry); |
1033 | spin_unlock(&info->lock); | 1041 | spin_unlock(&info->lock); |