diff options
author | Matthew Wilcox (Oracle) <willy@infradead.org> | 2022-06-21 20:47:08 +0000 |
---|---|---|
committer | akpm <akpm@linux-foundation.org> | 2022-06-27 13:45:07 -0700 |
commit | 5d4a6d0ae75982552543eda2afe185778af0ce3c (patch) | |
tree | ae58f63c6311063cd0b6dc7d06c5b62b4c953abd /kernel | |
parent | 6129ee70c0f0a44ae9666d5cda0c74e80697c8b9 (diff) | |
download | linux-next-5d4a6d0ae75982552543eda2afe185778af0ce3c.tar.gz |
acct: use VMA iterator instead of linked list
The VMA iterator is faster than the linked list.
Link: https://lkml.kernel.org/r/20220504011345.662299-31-Liam.Howlett@oracle.com
Link: https://lkml.kernel.org/r/20220621204632.3370049-47-Liam.Howlett@oracle.com
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>
Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: David Howells <dhowells@redhat.com>
Cc: SeongJae Park <sj@kernel.org>
Cc: Will Deacon <will@kernel.org>
Cc: Davidlohr Bueso <dave@stgolabs.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/acct.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/kernel/acct.c b/kernel/acct.c index 13706356ec54..62200d799b9b 100644 --- a/kernel/acct.c +++ b/kernel/acct.c @@ -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(¤t->sighand->siglock); |