diff options
Diffstat (limited to 'mm/rmap.c')
-rw-r--r-- | mm/rmap.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -830,6 +830,17 @@ static void __page_check_anon_rmap(struct page *page, | |||
830 | void page_add_anon_rmap(struct page *page, | 830 | void page_add_anon_rmap(struct page *page, |
831 | struct vm_area_struct *vma, unsigned long address) | 831 | struct vm_area_struct *vma, unsigned long address) |
832 | { | 832 | { |
833 | do_page_add_anon_rmap(page, vma, address, 0); | ||
834 | } | ||
835 | |||
836 | /* | ||
837 | * Special version of the above for do_swap_page, which often runs | ||
838 | * into pages that are exclusively owned by the current process. | ||
839 | * Everybody else should continue to use page_add_anon_rmap above. | ||
840 | */ | ||
841 | void do_page_add_anon_rmap(struct page *page, | ||
842 | struct vm_area_struct *vma, unsigned long address, int exclusive) | ||
843 | { | ||
833 | int first = atomic_inc_and_test(&page->_mapcount); | 844 | int first = atomic_inc_and_test(&page->_mapcount); |
834 | if (first) | 845 | if (first) |
835 | __inc_zone_page_state(page, NR_ANON_PAGES); | 846 | __inc_zone_page_state(page, NR_ANON_PAGES); |
@@ -839,7 +850,7 @@ void page_add_anon_rmap(struct page *page, | |||
839 | VM_BUG_ON(!PageLocked(page)); | 850 | VM_BUG_ON(!PageLocked(page)); |
840 | VM_BUG_ON(address < vma->vm_start || address >= vma->vm_end); | 851 | VM_BUG_ON(address < vma->vm_start || address >= vma->vm_end); |
841 | if (first) | 852 | if (first) |
842 | __page_set_anon_rmap(page, vma, address, 0); | 853 | __page_set_anon_rmap(page, vma, address, exclusive); |
843 | else | 854 | else |
844 | __page_check_anon_rmap(page, vma, address); | 855 | __page_check_anon_rmap(page, vma, address); |
845 | } | 856 | } |