aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHugh Dickins <hugh@veritas.com>2005-10-29 21:15:56 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-10-30 00:40:37 -0400
commitab50b8ed818016cfecd747d6d4bb9139986bc029 (patch)
tree33c666578c14dccce05b3f7a5538405098eebcc4
parent72866f6f277ec0ddd6df7a3b6ecdcf59a28de115 (diff)
[PATCH] mm: vm_stat_account unshackled
The original vm_stat_account has fallen into disuse, with only one user, and only one user of vm_stat_unaccount. It's easier to keep track if we convert them all to __vm_stat_account, then free it from its __shackles. 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--arch/ia64/kernel/perfmon.c3
-rw-r--r--arch/ia64/mm/fault.c2
-rw-r--r--include/linux/mm.h16
-rw-r--r--kernel/fork.c2
-rw-r--r--mm/mmap.c20
-rw-r--r--mm/mprotect.c4
-rw-r--r--mm/mremap.c4
7 files changed, 20 insertions, 31 deletions
diff --git a/arch/ia64/kernel/perfmon.c b/arch/ia64/kernel/perfmon.c
index d71731ee5b61..f7dfc107cb7b 100644
--- a/arch/ia64/kernel/perfmon.c
+++ b/arch/ia64/kernel/perfmon.c
@@ -2352,7 +2352,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, pfm_context_t *ctx, unsigned lon
2352 insert_vm_struct(mm, vma); 2352 insert_vm_struct(mm, vma);
2353 2353
2354 mm->total_vm += size >> PAGE_SHIFT; 2354 mm->total_vm += size >> PAGE_SHIFT;
2355 vm_stat_account(vma); 2355 vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
2356 vma_pages(vma));
2356 up_write(&task->mm->mmap_sem); 2357 up_write(&task->mm->mmap_sem);
2357 2358
2358 /* 2359 /*
diff --git a/arch/ia64/mm/fault.c b/arch/ia64/mm/fault.c
index 3c32af910d60..f21b55549787 100644
--- a/arch/ia64/mm/fault.c
+++ b/arch/ia64/mm/fault.c
@@ -41,7 +41,7 @@ expand_backing_store (struct vm_area_struct *vma, unsigned long address)
41 vma->vm_mm->total_vm += grow; 41 vma->vm_mm->total_vm += grow;
42 if (vma->vm_flags & VM_LOCKED) 42 if (vma->vm_flags & VM_LOCKED)
43 vma->vm_mm->locked_vm += grow; 43 vma->vm_mm->locked_vm += grow;
44 __vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, grow); 44 vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, grow);
45 return 0; 45 return 0;
46} 46}
47 47
diff --git a/include/linux/mm.h b/include/linux/mm.h
index e1649578fb0c..376a466743bc 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -928,26 +928,14 @@ int remap_pfn_range(struct vm_area_struct *, unsigned long,
928 unsigned long, unsigned long, pgprot_t); 928 unsigned long, unsigned long, pgprot_t);
929 929
930#ifdef CONFIG_PROC_FS 930#ifdef CONFIG_PROC_FS
931void __vm_stat_account(struct mm_struct *, unsigned long, struct file *, long); 931void vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
932#else 932#else
933static inline void __vm_stat_account(struct mm_struct *mm, 933static inline void vm_stat_account(struct mm_struct *mm,
934 unsigned long flags, struct file *file, long pages) 934 unsigned long flags, struct file *file, long pages)
935{ 935{
936} 936}
937#endif /* CONFIG_PROC_FS */ 937#endif /* CONFIG_PROC_FS */
938 938
939static inline void vm_stat_account(struct vm_area_struct *vma)
940{
941 __vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
942 vma_pages(vma));
943}
944
945static inline void vm_stat_unaccount(struct vm_area_struct *vma)
946{
947 __vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
948 -vma_pages(vma));
949}
950
951/* update per process rss and vm hiwater data */ 939/* update per process rss and vm hiwater data */
952extern void update_mem_hiwater(struct task_struct *tsk); 940extern void update_mem_hiwater(struct task_struct *tsk);
953 941
diff --git a/kernel/fork.c b/kernel/fork.c
index 280bd44ac441..e2ff11f8c1b0 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -212,7 +212,7 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
212 if (mpnt->vm_flags & VM_DONTCOPY) { 212 if (mpnt->vm_flags & VM_DONTCOPY) {
213 long pages = vma_pages(mpnt); 213 long pages = vma_pages(mpnt);
214 mm->total_vm -= pages; 214 mm->total_vm -= pages;
215 __vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file, 215 vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file,
216 -pages); 216 -pages);
217 continue; 217 continue;
218 } 218 }
diff --git a/mm/mmap.c b/mm/mmap.c
index fa11d91242e8..e1780266ac7d 100644
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -832,7 +832,7 @@ none:
832} 832}
833 833
834#ifdef CONFIG_PROC_FS 834#ifdef CONFIG_PROC_FS
835void __vm_stat_account(struct mm_struct *mm, unsigned long flags, 835void vm_stat_account(struct mm_struct *mm, unsigned long flags,
836 struct file *file, long pages) 836 struct file *file, long pages)
837{ 837{
838 const unsigned long stack_flags 838 const unsigned long stack_flags
@@ -1110,7 +1110,7 @@ munmap_back:
1110 } 1110 }
1111out: 1111out:
1112 mm->total_vm += len >> PAGE_SHIFT; 1112 mm->total_vm += len >> PAGE_SHIFT;
1113 __vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT); 1113 vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT);
1114 if (vm_flags & VM_LOCKED) { 1114 if (vm_flags & VM_LOCKED) {
1115 mm->locked_vm += len >> PAGE_SHIFT; 1115 mm->locked_vm += len >> PAGE_SHIFT;
1116 make_pages_present(addr, addr + len); 1116 make_pages_present(addr, addr + len);
@@ -1475,7 +1475,7 @@ static int acct_stack_growth(struct vm_area_struct * vma, unsigned long size, un
1475 mm->total_vm += grow; 1475 mm->total_vm += grow;
1476 if (vma->vm_flags & VM_LOCKED) 1476 if (vma->vm_flags & VM_LOCKED)
1477 mm->locked_vm += grow; 1477 mm->locked_vm += grow;
1478 __vm_stat_account(mm, vma->vm_flags, vma->vm_file, grow); 1478 vm_stat_account(mm, vma->vm_flags, vma->vm_file, grow);
1479 return 0; 1479 return 0;
1480} 1480}
1481 1481
@@ -1610,15 +1610,15 @@ find_extend_vma(struct mm_struct * mm, unsigned long addr)
1610 * By the time this function is called, the area struct has been 1610 * By the time this function is called, the area struct has been
1611 * removed from the process mapping list. 1611 * removed from the process mapping list.
1612 */ 1612 */
1613static void unmap_vma(struct mm_struct *mm, struct vm_area_struct *area) 1613static void unmap_vma(struct mm_struct *mm, struct vm_area_struct *vma)
1614{ 1614{
1615 size_t len = area->vm_end - area->vm_start; 1615 long nrpages = vma_pages(vma);
1616 1616
1617 area->vm_mm->total_vm -= len >> PAGE_SHIFT; 1617 mm->total_vm -= nrpages;
1618 if (area->vm_flags & VM_LOCKED) 1618 if (vma->vm_flags & VM_LOCKED)
1619 area->vm_mm->locked_vm -= len >> PAGE_SHIFT; 1619 mm->locked_vm -= nrpages;
1620 vm_stat_unaccount(area); 1620 vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
1621 remove_vm_struct(area); 1621 remove_vm_struct(vma);
1622} 1622}
1623 1623
1624/* 1624/*
diff --git a/mm/mprotect.c b/mm/mprotect.c
index 57577f63b305..b426f01c5e9c 100644
--- a/mm/mprotect.c
+++ b/mm/mprotect.c
@@ -168,8 +168,8 @@ success:
168 vma->vm_flags = newflags; 168 vma->vm_flags = newflags;
169 vma->vm_page_prot = newprot; 169 vma->vm_page_prot = newprot;
170 change_protection(vma, start, end, newprot); 170 change_protection(vma, start, end, newprot);
171 __vm_stat_account(mm, oldflags, vma->vm_file, -nrpages); 171 vm_stat_account(mm, oldflags, vma->vm_file, -nrpages);
172 __vm_stat_account(mm, newflags, vma->vm_file, nrpages); 172 vm_stat_account(mm, newflags, vma->vm_file, nrpages);
173 return 0; 173 return 0;
174 174
175fail: 175fail:
diff --git a/mm/mremap.c b/mm/mremap.c
index f343fc73a8bd..55df8f53e84d 100644
--- a/mm/mremap.c
+++ b/mm/mremap.c
@@ -233,7 +233,7 @@ static unsigned long move_vma(struct vm_area_struct *vma,
233 * since do_munmap() will decrement it by old_len == new_len 233 * since do_munmap() will decrement it by old_len == new_len
234 */ 234 */
235 mm->total_vm += new_len >> PAGE_SHIFT; 235 mm->total_vm += new_len >> PAGE_SHIFT;
236 __vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT); 236 vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT);
237 237
238 if (do_munmap(mm, old_addr, old_len) < 0) { 238 if (do_munmap(mm, old_addr, old_len) < 0) {
239 /* OOM: unable to split vma, just get accounts right */ 239 /* OOM: unable to split vma, just get accounts right */
@@ -384,7 +384,7 @@ unsigned long do_mremap(unsigned long addr,
384 addr + new_len, vma->vm_pgoff, NULL); 384 addr + new_len, vma->vm_pgoff, NULL);
385 385
386 current->mm->total_vm += pages; 386 current->mm->total_vm += pages;
387 __vm_stat_account(vma->vm_mm, vma->vm_flags, 387 vm_stat_account(vma->vm_mm, vma->vm_flags,
388 vma->vm_file, pages); 388 vma->vm_file, pages);
389 if (vma->vm_flags & VM_LOCKED) { 389 if (vma->vm_flags & VM_LOCKED) {
390 current->mm->locked_vm += pages; 390 current->mm->locked_vm += pages;