[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>
This commit is contained in:
parent
72866f6f27
commit
ab50b8ed81
|
@ -2352,7 +2352,8 @@ pfm_smpl_buffer_alloc(struct task_struct *task, pfm_context_t *ctx, unsigned lon
|
||||||
insert_vm_struct(mm, vma);
|
insert_vm_struct(mm, vma);
|
||||||
|
|
||||||
mm->total_vm += size >> PAGE_SHIFT;
|
mm->total_vm += size >> PAGE_SHIFT;
|
||||||
vm_stat_account(vma);
|
vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
|
||||||
|
vma_pages(vma));
|
||||||
up_write(&task->mm->mmap_sem);
|
up_write(&task->mm->mmap_sem);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -41,7 +41,7 @@ expand_backing_store (struct vm_area_struct *vma, unsigned long address)
|
||||||
vma->vm_mm->total_vm += grow;
|
vma->vm_mm->total_vm += grow;
|
||||||
if (vma->vm_flags & VM_LOCKED)
|
if (vma->vm_flags & VM_LOCKED)
|
||||||
vma->vm_mm->locked_vm += grow;
|
vma->vm_mm->locked_vm += grow;
|
||||||
__vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, grow);
|
vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file, grow);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -928,26 +928,14 @@ int remap_pfn_range(struct vm_area_struct *, unsigned long,
|
||||||
unsigned long, unsigned long, pgprot_t);
|
unsigned long, unsigned long, pgprot_t);
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
void __vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
|
void vm_stat_account(struct mm_struct *, unsigned long, struct file *, long);
|
||||||
#else
|
#else
|
||||||
static inline void __vm_stat_account(struct mm_struct *mm,
|
static inline void vm_stat_account(struct mm_struct *mm,
|
||||||
unsigned long flags, struct file *file, long pages)
|
unsigned long flags, struct file *file, long pages)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
#endif /* CONFIG_PROC_FS */
|
#endif /* CONFIG_PROC_FS */
|
||||||
|
|
||||||
static inline void vm_stat_account(struct vm_area_struct *vma)
|
|
||||||
{
|
|
||||||
__vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
|
|
||||||
vma_pages(vma));
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline void vm_stat_unaccount(struct vm_area_struct *vma)
|
|
||||||
{
|
|
||||||
__vm_stat_account(vma->vm_mm, vma->vm_flags, vma->vm_file,
|
|
||||||
-vma_pages(vma));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* update per process rss and vm hiwater data */
|
/* update per process rss and vm hiwater data */
|
||||||
extern void update_mem_hiwater(struct task_struct *tsk);
|
extern void update_mem_hiwater(struct task_struct *tsk);
|
||||||
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ static inline int dup_mmap(struct mm_struct * mm, struct mm_struct * oldmm)
|
||||||
if (mpnt->vm_flags & VM_DONTCOPY) {
|
if (mpnt->vm_flags & VM_DONTCOPY) {
|
||||||
long pages = vma_pages(mpnt);
|
long pages = vma_pages(mpnt);
|
||||||
mm->total_vm -= pages;
|
mm->total_vm -= pages;
|
||||||
__vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file,
|
vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file,
|
||||||
-pages);
|
-pages);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
20
mm/mmap.c
20
mm/mmap.c
|
@ -832,7 +832,7 @@ none:
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PROC_FS
|
#ifdef CONFIG_PROC_FS
|
||||||
void __vm_stat_account(struct mm_struct *mm, unsigned long flags,
|
void vm_stat_account(struct mm_struct *mm, unsigned long flags,
|
||||||
struct file *file, long pages)
|
struct file *file, long pages)
|
||||||
{
|
{
|
||||||
const unsigned long stack_flags
|
const unsigned long stack_flags
|
||||||
|
@ -1110,7 +1110,7 @@ munmap_back:
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
mm->total_vm += len >> PAGE_SHIFT;
|
mm->total_vm += len >> PAGE_SHIFT;
|
||||||
__vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT);
|
vm_stat_account(mm, vm_flags, file, len >> PAGE_SHIFT);
|
||||||
if (vm_flags & VM_LOCKED) {
|
if (vm_flags & VM_LOCKED) {
|
||||||
mm->locked_vm += len >> PAGE_SHIFT;
|
mm->locked_vm += len >> PAGE_SHIFT;
|
||||||
make_pages_present(addr, addr + len);
|
make_pages_present(addr, addr + len);
|
||||||
|
@ -1475,7 +1475,7 @@ static int acct_stack_growth(struct vm_area_struct * vma, unsigned long size, un
|
||||||
mm->total_vm += grow;
|
mm->total_vm += grow;
|
||||||
if (vma->vm_flags & VM_LOCKED)
|
if (vma->vm_flags & VM_LOCKED)
|
||||||
mm->locked_vm += grow;
|
mm->locked_vm += grow;
|
||||||
__vm_stat_account(mm, vma->vm_flags, vma->vm_file, grow);
|
vm_stat_account(mm, vma->vm_flags, vma->vm_file, grow);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1610,15 +1610,15 @@ find_extend_vma(struct mm_struct * mm, unsigned long addr)
|
||||||
* By the time this function is called, the area struct has been
|
* By the time this function is called, the area struct has been
|
||||||
* removed from the process mapping list.
|
* removed from the process mapping list.
|
||||||
*/
|
*/
|
||||||
static void unmap_vma(struct mm_struct *mm, struct vm_area_struct *area)
|
static void unmap_vma(struct mm_struct *mm, struct vm_area_struct *vma)
|
||||||
{
|
{
|
||||||
size_t len = area->vm_end - area->vm_start;
|
long nrpages = vma_pages(vma);
|
||||||
|
|
||||||
area->vm_mm->total_vm -= len >> PAGE_SHIFT;
|
mm->total_vm -= nrpages;
|
||||||
if (area->vm_flags & VM_LOCKED)
|
if (vma->vm_flags & VM_LOCKED)
|
||||||
area->vm_mm->locked_vm -= len >> PAGE_SHIFT;
|
mm->locked_vm -= nrpages;
|
||||||
vm_stat_unaccount(area);
|
vm_stat_account(mm, vma->vm_flags, vma->vm_file, -nrpages);
|
||||||
remove_vm_struct(area);
|
remove_vm_struct(vma);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -168,8 +168,8 @@ success:
|
||||||
vma->vm_flags = newflags;
|
vma->vm_flags = newflags;
|
||||||
vma->vm_page_prot = newprot;
|
vma->vm_page_prot = newprot;
|
||||||
change_protection(vma, start, end, newprot);
|
change_protection(vma, start, end, newprot);
|
||||||
__vm_stat_account(mm, oldflags, vma->vm_file, -nrpages);
|
vm_stat_account(mm, oldflags, vma->vm_file, -nrpages);
|
||||||
__vm_stat_account(mm, newflags, vma->vm_file, nrpages);
|
vm_stat_account(mm, newflags, vma->vm_file, nrpages);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
|
@ -233,7 +233,7 @@ static unsigned long move_vma(struct vm_area_struct *vma,
|
||||||
* since do_munmap() will decrement it by old_len == new_len
|
* since do_munmap() will decrement it by old_len == new_len
|
||||||
*/
|
*/
|
||||||
mm->total_vm += new_len >> PAGE_SHIFT;
|
mm->total_vm += new_len >> PAGE_SHIFT;
|
||||||
__vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT);
|
vm_stat_account(mm, vma->vm_flags, vma->vm_file, new_len>>PAGE_SHIFT);
|
||||||
|
|
||||||
if (do_munmap(mm, old_addr, old_len) < 0) {
|
if (do_munmap(mm, old_addr, old_len) < 0) {
|
||||||
/* OOM: unable to split vma, just get accounts right */
|
/* OOM: unable to split vma, just get accounts right */
|
||||||
|
@ -384,7 +384,7 @@ unsigned long do_mremap(unsigned long addr,
|
||||||
addr + new_len, vma->vm_pgoff, NULL);
|
addr + new_len, vma->vm_pgoff, NULL);
|
||||||
|
|
||||||
current->mm->total_vm += pages;
|
current->mm->total_vm += pages;
|
||||||
__vm_stat_account(vma->vm_mm, vma->vm_flags,
|
vm_stat_account(vma->vm_mm, vma->vm_flags,
|
||||||
vma->vm_file, pages);
|
vma->vm_file, pages);
|
||||||
if (vma->vm_flags & VM_LOCKED) {
|
if (vma->vm_flags & VM_LOCKED) {
|
||||||
current->mm->locked_vm += pages;
|
current->mm->locked_vm += pages;
|
||||||
|
|
Loading…
Reference in New Issue