Commit 2040ae81 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] task_vsize() speedup

From: William Lee Irwin III <wli@holomorphy.com>

task_vsize() mysteriously appeared on my profiles.  This should remove it
from them by using the already in-use elsewhere for rlimit checks
mm->total_vm for the benefit of O(1) cachelines touched.
parent e1851a6c
......@@ -45,13 +45,7 @@ char *task_mem(struct mm_struct *mm, char *buffer)
unsigned long task_vsize(struct mm_struct *mm)
{
struct vm_area_struct *vma;
unsigned long vsize = 0;
for (vma = mm->mmap; vma; vma = vma->vm_next)
vsize += vma->vm_end - vma->vm_start;
return vsize;
return PAGE_SIZE * mm->total_vm;
}
int task_statm(struct mm_struct *mm, int *shared, int *text,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment