Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs/proc: do_task_stat: use __for_each_thread()

do/while_each_thread should be avoided when possible.

Link: https://lkml.kernel.org/r/20230909164501.GA11581@redhat.com
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: Eric W. Biederman <ebiederm@xmission.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>

authored by

Oleg Nesterov and committed by
Andrew Morton
7904e53e a9d56ce0

+4 -3
+4 -3
fs/proc/array.c
··· 536 536 537 537 /* add up live thread stats at the group level */ 538 538 if (whole) { 539 - struct task_struct *t = task; 540 - do { 539 + struct task_struct *t; 540 + 541 + __for_each_thread(sig, t) { 541 542 min_flt += t->min_flt; 542 543 maj_flt += t->maj_flt; 543 544 gtime += task_gtime(t); 544 - } while_each_thread(task, t); 545 + } 545 546 546 547 min_flt += sig->min_flt; 547 548 maj_flt += sig->maj_flt;