lkml.org 
[lkml]   [2023]   [Sep]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH 2/2] 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.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/sys.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/kernel/sys.c b/kernel/sys.c
index 097cbea62a72..67436d465be4 100644
--- a/kernel/sys.c
+++ b/kernel/sys.c
@@ -1830,10 +1830,8 @@ void getrusage(struct task_struct *p, int who, struct rusage *r)
r->ru_oublock += sig->oublock;
if (maxrss < sig->maxrss)
maxrss = sig->maxrss;
- t = p;
- do {
+ __for_each_thread(sig, t)
accumulate_thread_rusage(t, r);
- } while_each_thread(p, t);
break;

default:
--
2.25.1.362.g51ebf55

\
 
 \ /
  Last update: 2023-09-09 19:29    [W:0.053 / U:1.164 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site