Skip to content

Commit

Permalink
acct: use VMA iterator instead of linked list
Browse files Browse the repository at this point in the history
The VMA iterator is faster than the linked list.

Signed-off-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Signed-off-by: Liam R. Howlett <Liam.Howlett@Oracle.com>
Acked-by: Vlastimil Babka <vbabka@suse.cz>
Reviewed-by: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Alexandre Frade <kernel@xanmod.org>
  • Loading branch information
Matthew Wilcox (Oracle) authored and xanmod committed Oct 3, 2022
1 parent c281f41 commit 4647180
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions kernel/acct.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,15 +555,14 @@ void acct_collect(long exitcode, int group_dead)
unsigned long vsize = 0;

if (group_dead && current->mm) {
struct mm_struct *mm = current->mm;
VMA_ITERATOR(vmi, mm, 0);
struct vm_area_struct *vma;

mmap_read_lock(current->mm);
vma = current->mm->mmap;
while (vma) {
mmap_read_lock(mm);
for_each_vma(vmi, vma)
vsize += vma->vm_end - vma->vm_start;
vma = vma->vm_next;
}
mmap_read_unlock(current->mm);
mmap_read_unlock(mm);
}

spin_lock_irq(&current->sighand->siglock);
Expand Down

0 comments on commit 4647180

Please sign in to comment.