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.

getrusage: use __for_each_thread()

do/while_each_thread should be avoided when possible.

Plus this change allows to avoid lock_task_sighand(), we can use rcu
and/or sig->stats_lock instead.

Link: https://lkml.kernel.org/r/20230909172629.GA20454@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
13b7bc60 c7ac8231

+1 -3
+1 -3
kernel/sys.c
··· 1830 1830 r->ru_oublock += sig->oublock; 1831 1831 if (maxrss < sig->maxrss) 1832 1832 maxrss = sig->maxrss; 1833 - t = p; 1834 - do { 1833 + __for_each_thread(sig, t) 1835 1834 accumulate_thread_rusage(t, r); 1836 - } while_each_thread(p, t); 1837 1835 break; 1838 1836 1839 1837 default: