diff options
author | Hugh Dickins <hugh@veritas.com> | 2005-10-29 21:16:05 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-10-30 00:40:38 -0400 |
commit | 4294621f41a85497019fae64341aa5351a1921b7 (patch) | |
tree | fdeb7eb44384a99d0679ffa6de5019bab0ea2166 | |
parent | 404351e67a9facb475abf1492245374a28d13e90 (diff) |
[PATCH] mm: rss = file_rss + anon_rss
I was lazy when we added anon_rss, and chose to change as few places as
possible. So currently each anonymous page has to be counted twice, in rss
and in anon_rss. Which won't be so good if those are atomic counts in some
configurations.
Change that around: keep file_rss and anon_rss separately, and add them
together (with get_mm_rss macro) when the total is needed - reading two
atomics is much cheaper than updating two atomics. And update anon_rss
upfront, typically in memory.c, not tucked away in page_add_anon_rmap.
Signed-off-by: Hugh Dickins <hugh@veritas.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r-- | fs/exec.c | 2 | ||||
-rw-r--r-- | fs/proc/array.c | 2 | ||||
-rw-r--r-- | fs/proc/task_mmu.c | 8 | ||||
-rw-r--r-- | include/linux/sched.h | 4 | ||||
-rw-r--r-- | kernel/acct.c | 2 | ||||
-rw-r--r-- | kernel/fork.c | 4 | ||||
-rw-r--r-- | mm/fremap.c | 4 | ||||
-rw-r--r-- | mm/hugetlb.c | 6 | ||||
-rw-r--r-- | mm/memory.c | 31 | ||||
-rw-r--r-- | mm/nommu.c | 2 | ||||
-rw-r--r-- | mm/rmap.c | 8 | ||||
-rw-r--r-- | mm/swapfile.c | 2 |
12 files changed, 38 insertions, 37 deletions
@@ -330,7 +330,7 @@ void install_arg_page(struct vm_area_struct *vma, | |||
330 | pte_unmap(pte); | 330 | pte_unmap(pte); |
331 | goto out; | 331 | goto out; |
332 | } | 332 | } |
333 | inc_mm_counter(mm, rss); | 333 | inc_mm_counter(mm, anon_rss); |
334 | lru_cache_add_active(page); | 334 | lru_cache_add_active(page); |
335 | set_pte_at(mm, address, pte, pte_mkdirty(pte_mkwrite(mk_pte( | 335 | set_pte_at(mm, address, pte, pte_mkdirty(pte_mkwrite(mk_pte( |
336 | page, vma->vm_page_prot)))); | 336 | page, vma->vm_page_prot)))); |
diff --git a/fs/proc/array.c b/fs/proc/array.c index d84eecacbeaf..3e1239e4b303 100644 --- a/fs/proc/array.c +++ b/fs/proc/array.c | |||
@@ -438,7 +438,7 @@ static int do_task_stat(struct task_struct *task, char * buffer, int whole) | |||
438 | jiffies_to_clock_t(it_real_value), | 438 | jiffies_to_clock_t(it_real_value), |
439 | start_time, | 439 | start_time, |
440 | vsize, | 440 | vsize, |
441 | mm ? get_mm_counter(mm, rss) : 0, /* you might want to shift this left 3 */ | 441 | mm ? get_mm_rss(mm) : 0, |
442 | rsslim, | 442 | rsslim, |
443 | mm ? mm->start_code : 0, | 443 | mm ? mm->start_code : 0, |
444 | mm ? mm->end_code : 0, | 444 | mm ? mm->end_code : 0, |
diff --git a/fs/proc/task_mmu.c b/fs/proc/task_mmu.c index 994612bc72d0..bccee7cf9ccd 100644 --- a/fs/proc/task_mmu.c +++ b/fs/proc/task_mmu.c | |||
@@ -29,7 +29,7 @@ char *task_mem(struct mm_struct *mm, char *buffer) | |||
29 | "VmPTE:\t%8lu kB\n", | 29 | "VmPTE:\t%8lu kB\n", |
30 | (mm->total_vm - mm->reserved_vm) << (PAGE_SHIFT-10), | 30 | (mm->total_vm - mm->reserved_vm) << (PAGE_SHIFT-10), |
31 | mm->locked_vm << (PAGE_SHIFT-10), | 31 | mm->locked_vm << (PAGE_SHIFT-10), |
32 | get_mm_counter(mm, rss) << (PAGE_SHIFT-10), | 32 | get_mm_rss(mm) << (PAGE_SHIFT-10), |
33 | data << (PAGE_SHIFT-10), | 33 | data << (PAGE_SHIFT-10), |
34 | mm->stack_vm << (PAGE_SHIFT-10), text, lib, | 34 | mm->stack_vm << (PAGE_SHIFT-10), text, lib, |
35 | (PTRS_PER_PTE*sizeof(pte_t)*mm->nr_ptes) >> 10); | 35 | (PTRS_PER_PTE*sizeof(pte_t)*mm->nr_ptes) >> 10); |
@@ -44,13 +44,11 @@ unsigned long task_vsize(struct mm_struct *mm) | |||
44 | int task_statm(struct mm_struct *mm, int *shared, int *text, | 44 | int task_statm(struct mm_struct *mm, int *shared, int *text, |
45 | int *data, int *resident) | 45 | int *data, int *resident) |
46 | { | 46 | { |
47 | int rss = get_mm_counter(mm, rss); | 47 | *shared = get_mm_counter(mm, file_rss); |
48 | |||
49 | *shared = rss - get_mm_counter(mm, anon_rss); | ||
50 | *text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) | 48 | *text = (PAGE_ALIGN(mm->end_code) - (mm->start_code & PAGE_MASK)) |
51 | >> PAGE_SHIFT; | 49 | >> PAGE_SHIFT; |
52 | *data = mm->total_vm - mm->shared_vm; | 50 | *data = mm->total_vm - mm->shared_vm; |
53 | *resident = rss; | 51 | *resident = *shared + get_mm_counter(mm, anon_rss); |
54 | return mm->total_vm; | 52 | return mm->total_vm; |
55 | } | 53 | } |
56 | 54 | ||
diff --git a/include/linux/sched.h b/include/linux/sched.h index 27519df0f987..afcaac66cbd5 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h | |||
@@ -254,6 +254,8 @@ extern void arch_unmap_area_topdown(struct mm_struct *, unsigned long); | |||
254 | #define add_mm_counter(mm, member, value) (mm)->_##member += (value) | 254 | #define add_mm_counter(mm, member, value) (mm)->_##member += (value) |
255 | #define inc_mm_counter(mm, member) (mm)->_##member++ | 255 | #define inc_mm_counter(mm, member) (mm)->_##member++ |
256 | #define dec_mm_counter(mm, member) (mm)->_##member-- | 256 | #define dec_mm_counter(mm, member) (mm)->_##member-- |
257 | #define get_mm_rss(mm) ((mm)->_file_rss + (mm)->_anon_rss) | ||
258 | |||
257 | typedef unsigned long mm_counter_t; | 259 | typedef unsigned long mm_counter_t; |
258 | 260 | ||
259 | struct mm_struct { | 261 | struct mm_struct { |
@@ -286,7 +288,7 @@ struct mm_struct { | |||
286 | unsigned long exec_vm, stack_vm, reserved_vm, def_flags, nr_ptes; | 288 | unsigned long exec_vm, stack_vm, reserved_vm, def_flags, nr_ptes; |
287 | 289 | ||
288 | /* Special counters protected by the page_table_lock */ | 290 | /* Special counters protected by the page_table_lock */ |
289 | mm_counter_t _rss; | 291 | mm_counter_t _file_rss; |
290 | mm_counter_t _anon_rss; | 292 | mm_counter_t _anon_rss; |
291 | 293 | ||
292 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ | 294 | unsigned long saved_auxv[AT_VECTOR_SIZE]; /* for /proc/PID/auxv */ |
diff --git a/kernel/acct.c b/kernel/acct.c index b756f527497e..2e3f4a47e7d0 100644 --- a/kernel/acct.c +++ b/kernel/acct.c | |||
@@ -553,7 +553,7 @@ void acct_update_integrals(struct task_struct *tsk) | |||
553 | if (delta == 0) | 553 | if (delta == 0) |
554 | return; | 554 | return; |
555 | tsk->acct_stimexpd = tsk->stime; | 555 | tsk->acct_stimexpd = tsk->stime; |
556 | tsk->acct_rss_mem1 += delta * get_mm_counter(tsk->mm, rss); | 556 | tsk->acct_rss_mem1 += delta * get_mm_rss(tsk->mm); |
557 | tsk->acct_vm_mem1 += delta * tsk->mm->total_vm; | 557 | tsk->acct_vm_mem1 += delta * tsk->mm->total_vm; |
558 | } | 558 | } |
559 | } | 559 | } |
diff --git a/kernel/fork.c b/kernel/fork.c index 25caa02e2eac..2048ed7b5872 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -321,7 +321,7 @@ static struct mm_struct * mm_init(struct mm_struct * mm) | |||
321 | INIT_LIST_HEAD(&mm->mmlist); | 321 | INIT_LIST_HEAD(&mm->mmlist); |
322 | mm->core_waiters = 0; | 322 | mm->core_waiters = 0; |
323 | mm->nr_ptes = 0; | 323 | mm->nr_ptes = 0; |
324 | set_mm_counter(mm, rss, 0); | 324 | set_mm_counter(mm, file_rss, 0); |
325 | set_mm_counter(mm, anon_rss, 0); | 325 | set_mm_counter(mm, anon_rss, 0); |
326 | spin_lock_init(&mm->page_table_lock); | 326 | spin_lock_init(&mm->page_table_lock); |
327 | rwlock_init(&mm->ioctx_list_lock); | 327 | rwlock_init(&mm->ioctx_list_lock); |
@@ -499,7 +499,7 @@ static int copy_mm(unsigned long clone_flags, struct task_struct * tsk) | |||
499 | if (retval) | 499 | if (retval) |
500 | goto free_pt; | 500 | goto free_pt; |
501 | 501 | ||
502 | mm->hiwater_rss = get_mm_counter(mm,rss); | 502 | mm->hiwater_rss = get_mm_rss(mm); |
503 | mm->hiwater_vm = mm->total_vm; | 503 | mm->hiwater_vm = mm->total_vm; |
504 | 504 | ||
505 | good_mm: | 505 | good_mm: |
diff --git a/mm/fremap.c b/mm/fremap.c index ab23a0673c35..fd7f2a17ff3e 100644 --- a/mm/fremap.c +++ b/mm/fremap.c | |||
@@ -39,7 +39,7 @@ static inline void zap_pte(struct mm_struct *mm, struct vm_area_struct *vma, | |||
39 | set_page_dirty(page); | 39 | set_page_dirty(page); |
40 | page_remove_rmap(page); | 40 | page_remove_rmap(page); |
41 | page_cache_release(page); | 41 | page_cache_release(page); |
42 | dec_mm_counter(mm, rss); | 42 | dec_mm_counter(mm, file_rss); |
43 | } | 43 | } |
44 | } | 44 | } |
45 | } else { | 45 | } else { |
@@ -95,7 +95,7 @@ int install_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
95 | 95 | ||
96 | zap_pte(mm, vma, addr, pte); | 96 | zap_pte(mm, vma, addr, pte); |
97 | 97 | ||
98 | inc_mm_counter(mm,rss); | 98 | inc_mm_counter(mm, file_rss); |
99 | flush_icache_page(vma, page); | 99 | flush_icache_page(vma, page); |
100 | set_pte_at(mm, addr, pte, mk_pte(page, prot)); | 100 | set_pte_at(mm, addr, pte, mk_pte(page, prot)); |
101 | page_add_file_rmap(page); | 101 | page_add_file_rmap(page); |
diff --git a/mm/hugetlb.c b/mm/hugetlb.c index 61d380678030..094455bcbbf7 100644 --- a/mm/hugetlb.c +++ b/mm/hugetlb.c | |||
@@ -286,7 +286,7 @@ int copy_hugetlb_page_range(struct mm_struct *dst, struct mm_struct *src, | |||
286 | entry = *src_pte; | 286 | entry = *src_pte; |
287 | ptepage = pte_page(entry); | 287 | ptepage = pte_page(entry); |
288 | get_page(ptepage); | 288 | get_page(ptepage); |
289 | add_mm_counter(dst, rss, HPAGE_SIZE / PAGE_SIZE); | 289 | add_mm_counter(dst, file_rss, HPAGE_SIZE / PAGE_SIZE); |
290 | set_huge_pte_at(dst, addr, dst_pte, entry); | 290 | set_huge_pte_at(dst, addr, dst_pte, entry); |
291 | } | 291 | } |
292 | spin_unlock(&src->page_table_lock); | 292 | spin_unlock(&src->page_table_lock); |
@@ -324,7 +324,7 @@ void unmap_hugepage_range(struct vm_area_struct *vma, unsigned long start, | |||
324 | 324 | ||
325 | page = pte_page(pte); | 325 | page = pte_page(pte); |
326 | put_page(page); | 326 | put_page(page); |
327 | add_mm_counter(mm, rss, - (HPAGE_SIZE / PAGE_SIZE)); | 327 | add_mm_counter(mm, file_rss, (int) -(HPAGE_SIZE / PAGE_SIZE)); |
328 | } | 328 | } |
329 | flush_tlb_range(vma, start, end); | 329 | flush_tlb_range(vma, start, end); |
330 | } | 330 | } |
@@ -386,7 +386,7 @@ int hugetlb_prefault(struct address_space *mapping, struct vm_area_struct *vma) | |||
386 | goto out; | 386 | goto out; |
387 | } | 387 | } |
388 | } | 388 | } |
389 | add_mm_counter(mm, rss, HPAGE_SIZE / PAGE_SIZE); | 389 | add_mm_counter(mm, file_rss, HPAGE_SIZE / PAGE_SIZE); |
390 | set_huge_pte_at(mm, addr, pte, make_huge_pte(vma, page)); | 390 | set_huge_pte_at(mm, addr, pte, make_huge_pte(vma, page)); |
391 | } | 391 | } |
392 | out: | 392 | out: |
diff --git a/mm/memory.c b/mm/memory.c index 51eb38574830..59d42e50fa53 100644 --- a/mm/memory.c +++ b/mm/memory.c | |||
@@ -397,9 +397,10 @@ copy_one_pte(struct mm_struct *dst_mm, struct mm_struct *src_mm, | |||
397 | pte = pte_mkclean(pte); | 397 | pte = pte_mkclean(pte); |
398 | pte = pte_mkold(pte); | 398 | pte = pte_mkold(pte); |
399 | get_page(page); | 399 | get_page(page); |
400 | inc_mm_counter(dst_mm, rss); | ||
401 | if (PageAnon(page)) | 400 | if (PageAnon(page)) |
402 | inc_mm_counter(dst_mm, anon_rss); | 401 | inc_mm_counter(dst_mm, anon_rss); |
402 | else | ||
403 | inc_mm_counter(dst_mm, file_rss); | ||
403 | set_pte_at(dst_mm, addr, dst_pte, pte); | 404 | set_pte_at(dst_mm, addr, dst_pte, pte); |
404 | page_dup_rmap(page); | 405 | page_dup_rmap(page); |
405 | } | 406 | } |
@@ -581,8 +582,8 @@ static void zap_pte_range(struct mmu_gather *tlb, pmd_t *pmd, | |||
581 | set_page_dirty(page); | 582 | set_page_dirty(page); |
582 | if (pte_young(ptent)) | 583 | if (pte_young(ptent)) |
583 | mark_page_accessed(page); | 584 | mark_page_accessed(page); |
585 | dec_mm_counter(tlb->mm, file_rss); | ||
584 | } | 586 | } |
585 | dec_mm_counter(tlb->mm, rss); | ||
586 | page_remove_rmap(page); | 587 | page_remove_rmap(page); |
587 | tlb_remove_page(tlb, page); | 588 | tlb_remove_page(tlb, page); |
588 | continue; | 589 | continue; |
@@ -1290,13 +1291,15 @@ static int do_wp_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
1290 | spin_lock(&mm->page_table_lock); | 1291 | spin_lock(&mm->page_table_lock); |
1291 | page_table = pte_offset_map(pmd, address); | 1292 | page_table = pte_offset_map(pmd, address); |
1292 | if (likely(pte_same(*page_table, orig_pte))) { | 1293 | if (likely(pte_same(*page_table, orig_pte))) { |
1293 | if (PageAnon(old_page)) | ||
1294 | dec_mm_counter(mm, anon_rss); | ||
1295 | if (PageReserved(old_page)) | 1294 | if (PageReserved(old_page)) |
1296 | inc_mm_counter(mm, rss); | 1295 | inc_mm_counter(mm, anon_rss); |
1297 | else | 1296 | else { |
1298 | page_remove_rmap(old_page); | 1297 | page_remove_rmap(old_page); |
1299 | 1298 | if (!PageAnon(old_page)) { | |
1299 | inc_mm_counter(mm, anon_rss); | ||
1300 | dec_mm_counter(mm, file_rss); | ||
1301 | } | ||
1302 | } | ||
1300 | flush_cache_page(vma, address, pfn); | 1303 | flush_cache_page(vma, address, pfn); |
1301 | entry = mk_pte(new_page, vma->vm_page_prot); | 1304 | entry = mk_pte(new_page, vma->vm_page_prot); |
1302 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); | 1305 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); |
@@ -1701,7 +1704,7 @@ static int do_swap_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
1701 | 1704 | ||
1702 | /* The page isn't present yet, go ahead with the fault. */ | 1705 | /* The page isn't present yet, go ahead with the fault. */ |
1703 | 1706 | ||
1704 | inc_mm_counter(mm, rss); | 1707 | inc_mm_counter(mm, anon_rss); |
1705 | pte = mk_pte(page, vma->vm_page_prot); | 1708 | pte = mk_pte(page, vma->vm_page_prot); |
1706 | if (write_access && can_share_swap_page(page)) { | 1709 | if (write_access && can_share_swap_page(page)) { |
1707 | pte = maybe_mkwrite(pte_mkdirty(pte), vma); | 1710 | pte = maybe_mkwrite(pte_mkdirty(pte), vma); |
@@ -1774,7 +1777,7 @@ static int do_anonymous_page(struct mm_struct *mm, struct vm_area_struct *vma, | |||
1774 | page_cache_release(page); | 1777 | page_cache_release(page); |
1775 | goto unlock; | 1778 | goto unlock; |
1776 | } | 1779 | } |
1777 | inc_mm_counter(mm, rss); | 1780 | inc_mm_counter(mm, anon_rss); |
1778 | entry = mk_pte(page, vma->vm_page_prot); | 1781 | entry = mk_pte(page, vma->vm_page_prot); |
1779 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); | 1782 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); |
1780 | lru_cache_add_active(page); | 1783 | lru_cache_add_active(page); |
@@ -1887,19 +1890,19 @@ retry: | |||
1887 | */ | 1890 | */ |
1888 | /* Only go through if we didn't race with anybody else... */ | 1891 | /* Only go through if we didn't race with anybody else... */ |
1889 | if (pte_none(*page_table)) { | 1892 | if (pte_none(*page_table)) { |
1890 | if (!PageReserved(new_page)) | ||
1891 | inc_mm_counter(mm, rss); | ||
1892 | |||
1893 | flush_icache_page(vma, new_page); | 1893 | flush_icache_page(vma, new_page); |
1894 | entry = mk_pte(new_page, vma->vm_page_prot); | 1894 | entry = mk_pte(new_page, vma->vm_page_prot); |
1895 | if (write_access) | 1895 | if (write_access) |
1896 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); | 1896 | entry = maybe_mkwrite(pte_mkdirty(entry), vma); |
1897 | set_pte_at(mm, address, page_table, entry); | 1897 | set_pte_at(mm, address, page_table, entry); |
1898 | if (anon) { | 1898 | if (anon) { |
1899 | inc_mm_counter(mm, anon_rss); | ||
1899 | lru_cache_add_active(new_page); | 1900 | lru_cache_add_active(new_page); |
1900 | page_add_anon_rmap(new_page, vma, address); | 1901 | page_add_anon_rmap(new_page, vma, address); |
1901 | } else | 1902 | } else if (!PageReserved(new_page)) { |
1903 | inc_mm_counter(mm, file_rss); | ||
1902 | page_add_file_rmap(new_page); | 1904 | page_add_file_rmap(new_page); |
1905 | } | ||
1903 | } else { | 1906 | } else { |
1904 | /* One of our sibling threads was faster, back out. */ | 1907 | /* One of our sibling threads was faster, back out. */ |
1905 | page_cache_release(new_page); | 1908 | page_cache_release(new_page); |
@@ -2192,7 +2195,7 @@ EXPORT_SYMBOL(vmalloc_to_pfn); | |||
2192 | void update_mem_hiwater(struct task_struct *tsk) | 2195 | void update_mem_hiwater(struct task_struct *tsk) |
2193 | { | 2196 | { |
2194 | if (tsk->mm) { | 2197 | if (tsk->mm) { |
2195 | unsigned long rss = get_mm_counter(tsk->mm, rss); | 2198 | unsigned long rss = get_mm_rss(tsk->mm); |
2196 | 2199 | ||
2197 | if (tsk->mm->hiwater_rss < rss) | 2200 | if (tsk->mm->hiwater_rss < rss) |
2198 | tsk->mm->hiwater_rss = rss; | 2201 | tsk->mm->hiwater_rss = rss; |
diff --git a/mm/nommu.c b/mm/nommu.c index 0ef241ae3763..599924886eb5 100644 --- a/mm/nommu.c +++ b/mm/nommu.c | |||
@@ -1083,7 +1083,7 @@ void update_mem_hiwater(struct task_struct *tsk) | |||
1083 | unsigned long rss; | 1083 | unsigned long rss; |
1084 | 1084 | ||
1085 | if (likely(tsk->mm)) { | 1085 | if (likely(tsk->mm)) { |
1086 | rss = get_mm_counter(tsk->mm, rss); | 1086 | rss = get_mm_rss(tsk->mm); |
1087 | if (tsk->mm->hiwater_rss < rss) | 1087 | if (tsk->mm->hiwater_rss < rss) |
1088 | tsk->mm->hiwater_rss = rss; | 1088 | tsk->mm->hiwater_rss = rss; |
1089 | if (tsk->mm->hiwater_vm < tsk->mm->total_vm) | 1089 | if (tsk->mm->hiwater_vm < tsk->mm->total_vm) |
@@ -445,8 +445,6 @@ void page_add_anon_rmap(struct page *page, | |||
445 | { | 445 | { |
446 | BUG_ON(PageReserved(page)); | 446 | BUG_ON(PageReserved(page)); |
447 | 447 | ||
448 | inc_mm_counter(vma->vm_mm, anon_rss); | ||
449 | |||
450 | if (atomic_inc_and_test(&page->_mapcount)) { | 448 | if (atomic_inc_and_test(&page->_mapcount)) { |
451 | struct anon_vma *anon_vma = vma->anon_vma; | 449 | struct anon_vma *anon_vma = vma->anon_vma; |
452 | 450 | ||
@@ -561,9 +559,9 @@ static int try_to_unmap_one(struct page *page, struct vm_area_struct *vma) | |||
561 | set_pte_at(mm, address, pte, swp_entry_to_pte(entry)); | 559 | set_pte_at(mm, address, pte, swp_entry_to_pte(entry)); |
562 | BUG_ON(pte_file(*pte)); | 560 | BUG_ON(pte_file(*pte)); |
563 | dec_mm_counter(mm, anon_rss); | 561 | dec_mm_counter(mm, anon_rss); |
564 | } | 562 | } else |
563 | dec_mm_counter(mm, file_rss); | ||
565 | 564 | ||
566 | dec_mm_counter(mm, rss); | ||
567 | page_remove_rmap(page); | 565 | page_remove_rmap(page); |
568 | page_cache_release(page); | 566 | page_cache_release(page); |
569 | 567 | ||
@@ -667,7 +665,7 @@ static void try_to_unmap_cluster(unsigned long cursor, | |||
667 | 665 | ||
668 | page_remove_rmap(page); | 666 | page_remove_rmap(page); |
669 | page_cache_release(page); | 667 | page_cache_release(page); |
670 | dec_mm_counter(mm, rss); | 668 | dec_mm_counter(mm, file_rss); |
671 | (*mapcount)--; | 669 | (*mapcount)--; |
672 | } | 670 | } |
673 | 671 | ||
diff --git a/mm/swapfile.c b/mm/swapfile.c index 05c851291241..296e0bbf7836 100644 --- a/mm/swapfile.c +++ b/mm/swapfile.c | |||
@@ -407,7 +407,7 @@ void free_swap_and_cache(swp_entry_t entry) | |||
407 | static void unuse_pte(struct vm_area_struct *vma, pte_t *pte, | 407 | static void unuse_pte(struct vm_area_struct *vma, pte_t *pte, |
408 | unsigned long addr, swp_entry_t entry, struct page *page) | 408 | unsigned long addr, swp_entry_t entry, struct page *page) |
409 | { | 409 | { |
410 | inc_mm_counter(vma->vm_mm, rss); | 410 | inc_mm_counter(vma->vm_mm, anon_rss); |
411 | get_page(page); | 411 | get_page(page); |
412 | set_pte_at(vma->vm_mm, addr, pte, | 412 | set_pte_at(vma->vm_mm, addr, pte, |
413 | pte_mkold(mk_pte(page, vma->vm_page_prot))); | 413 | pte_mkold(mk_pte(page, vma->vm_page_prot))); |