Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 19378
b: refs/heads/master
c: a3351e5
h: refs/heads/master
v: v3
  • Loading branch information
Christoph Lameter authored and Linus Torvalds committed Feb 1, 2006
1 parent 6a4d899 commit 5f1a0ca
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: a48d07afdf18212de22b959715b16793c5a6e57a
refs/heads/master: a3351e525e4768c29aa5d22ef59b5b38e0361e53
1 change: 1 addition & 0 deletions trunk/include/linux/rmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ static inline void page_dup_rmap(struct page *page)
*/
int page_referenced(struct page *, int is_locked);
int try_to_unmap(struct page *, int ignore_refs);
void remove_from_swap(struct page *page);

/*
* Called from mm/filemap_xip.c to unmap empty zero page
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/swap.h
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ extern int remove_exclusive_swap_page(struct page *);
struct backing_dev_info;

extern spinlock_t swap_lock;
extern int remove_vma_swap(struct vm_area_struct *vma, struct page *page);

/* linux/mm/thrash.c */
extern struct mm_struct * swap_token_mm;
Expand Down
29 changes: 29 additions & 0 deletions trunk/mm/rmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,35 @@ static struct anon_vma *page_lock_anon_vma(struct page *page)
return anon_vma;
}

#ifdef CONFIG_MIGRATION
/*
* Remove an anonymous page from swap replacing the swap pte's
* through real pte's pointing to valid pages and then releasing
* the page from the swap cache.
*
* Must hold page lock on page.
*/
void remove_from_swap(struct page *page)
{
struct anon_vma *anon_vma;
struct vm_area_struct *vma;

if (!PageAnon(page) || !PageSwapCache(page))
return;

anon_vma = page_lock_anon_vma(page);
if (!anon_vma)
return;

list_for_each_entry(vma, &anon_vma->head, anon_vma_node)
remove_vma_swap(vma, page);

spin_unlock(&anon_vma->lock);

delete_from_swap_cache(page);
}
#endif

/*
* At what user virtual address is page expected in vma?
*/
Expand Down
9 changes: 9 additions & 0 deletions trunk/mm/swapfile.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,15 @@ static int unuse_mm(struct mm_struct *mm,
return 0;
}

#ifdef CONFIG_MIGRATION
int remove_vma_swap(struct vm_area_struct *vma, struct page *page)
{
swp_entry_t entry = { .val = page_private(page) };

return unuse_vma(vma, entry, page);
}
#endif

/*
* Scan swap_map from current position to next entry still in use.
* Recycle to start on reaching the end, returning 0 when empty.
Expand Down
9 changes: 9 additions & 0 deletions trunk/mm/vmscan.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,6 +804,15 @@ int migrate_page(struct page *newpage, struct page *page)

migrate_page_copy(newpage, page);

/*
* Remove auxiliary swap entries and replace
* them with real ptes.
*
* Note that a real pte entry will allow processes that are not
* waiting on the page lock to use the new page via the page tables
* before the new page is unlocked.
*/
remove_from_swap(newpage);
return 0;
}

Expand Down

0 comments on commit 5f1a0ca

Please sign in to comment.