]> git.hungrycats.org Git - linux/commitdiff
[PATCH] task_vsize() speedup
authorAndrew Morton <akpm@digeo.com>
Wed, 9 Apr 2003 04:31:01 +0000 (21:31 -0700)
committerLinus Torvalds <torvalds@home.transmeta.com>
Wed, 9 Apr 2003 04:31:01 +0000 (21:31 -0700)
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.

fs/proc/task_mmu.c

index 3186fe7945ab41ffe48452f3a7ea0b7baede29bd..60ff443d4866e9a2c7df024fa75ffdffe7670593 100644 (file)
@@ -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,