diff options
author | Rik van Riel <riel@redhat.com> | 2010-08-09 20:19:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-08-09 23:45:02 -0400 |
commit | ad8c2ee801ad7a52d919b478d9b2c7b39a72d295 (patch) | |
tree | bc56cc023da3467447b0aecd30c0516881d53992 /mm/memory.c | |
parent | 51b1bd2ace1595b72956224deda349efa880b693 (diff) |
rmap: add exclusive page to private anon_vma on swapin
On swapin it is fairly common for a page to be owned exclusively by one
process. In that case we want to add the page to the anon_vma of that
process's VMA, instead of to the root anon_vma.
This will reduce the amount of rmap searching that the swapout code needs
to do.
Signed-off-by: Rik van Riel <riel@redhat.com>
Cc: Andrea Arcangeli <aarcange@redhat.com>
Cc: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'mm/memory.c')
-rw-r--r-- | mm/memory.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/mm/memory.c b/mm/memory.c index 6b0c37dcfd1..6bc039486e9 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -2628,6 +2628,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2628 | swp_entry_t entry; | 2628 | swp_entry_t entry; |
2629 | pte_t pte; | 2629 | pte_t pte; |
2630 | struct mem_cgroup *ptr = NULL; | 2630 | struct mem_cgroup *ptr = NULL; |
2631 | int exclusive = 0; | ||
2631 | int ret = 0; | 2632 | int ret = 0; |
2632 | 2633 | ||
2633 | if (!pte_unmap_same(mm, pmd, page_table, orig_pte)) | 2634 | if (!pte_unmap_same(mm, pmd, page_table, orig_pte)) |
@@ -2722,10 +2723,11 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
2722 | if ((flags & FAULT_FLAG_WRITE) && reuse_swap_page(page)) { | 2723 | if ((flags & FAULT_FLAG_WRITE) && reuse_swap_page(page)) { |
2723 | pte = maybe_mkwrite(pte_mkdirty(pte), vma); | 2724 | pte = maybe_mkwrite(pte_mkdirty(pte), vma); |
2724 | flags &= ~FAULT_FLAG_WRITE; | 2725 | flags &= ~FAULT_FLAG_WRITE; |
2726 | exclusive = 1; | ||
2725 | } | 2727 | } |
2726 | flush_icache_page(vma, page); | 2728 | flush_icache_page(vma, page); |
2727 | set_pte_at(mm, address, page_table, pte); | 2729 | set_pte_at(mm, address, page_table, pte); |
2728 | page_add_anon_rmap(page, vma, address); | 2730 | do_page_add_anon_rmap(page, vma, address, exclusive); |
2729 | /* It's better to call commit-charge after rmap is established */ | 2731 | /* It's better to call commit-charge after rmap is established */ |
2730 | mem_cgroup_commit_charge_swapin(page, ptr); | 2732 | mem_cgroup_commit_charge_swapin(page, ptr); |
2731 | 2733 | ||