diff options
author | Christoph Lameter <clameter@sgi.com> | 2006-02-01 03:05:36 -0800 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2006-02-01 08:53:16 -0800 |
commit | b16664e44c54525be89dc07ad15a13b4eeec5634 (patch) | |
tree | 1844d193009c1e55e3c26256feb14bc622ec9af3 /mm/memory.c | |
parent | 2a16e3f4b0c408b9e50297d2ec27e295d490267a (diff) | |
download | linux-3.10-b16664e44c54525be89dc07ad15a13b4eeec5634.tar.gz linux-3.10-b16664e44c54525be89dc07ad15a13b4eeec5634.tar.bz2 linux-3.10-b16664e44c54525be89dc07ad15a13b4eeec5634.zip |
[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/memory.c')
-rw-r--r-- | mm/memory.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/mm/memory.c b/mm/memory.c index 7a11ddd5060..2bee1f21aa8 100644 --- a/mm/memory.c +++ b/mm/memory.c @@ -1871,6 +1871,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, goto out; entry = pte_to_swp_entry(orig_pte); +again: page = lookup_swap_cache(entry); if (!page) { swapin_readahead(entry, address, vma); @@ -1894,6 +1895,12 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, mark_page_accessed(page); lock_page(page); + if (!PageSwapCache(page)) { + /* Page migration has occured */ + unlock_page(page); + page_cache_release(page); + goto again; + } /* * Back out if somebody else already faulted in this pte. |