@@ -1062,9 +1062,6 @@ static int wait_noreap_copyout(struct wait_opts *wo, struct task_struct *p,
1062
1062
{
1063
1063
struct waitid_info * infop ;
1064
1064
1065
- if (wo -> wo_rusage )
1066
- getrusage (p , RUSAGE_BOTH , wo -> wo_rusage );
1067
-
1068
1065
put_task_struct (p );
1069
1066
infop = wo -> wo_info ;
1070
1067
if (infop ) {
@@ -1099,6 +1096,8 @@ static int wait_task_zombie(struct wait_opts *wo, struct task_struct *p)
1099
1096
get_task_struct (p );
1100
1097
read_unlock (& tasklist_lock );
1101
1098
sched_annotate_sleep ();
1099
+ if (wo -> wo_rusage )
1100
+ getrusage (p , RUSAGE_BOTH , wo -> wo_rusage );
1102
1101
1103
1102
if ((exit_code & 0x7f ) == 0 ) {
1104
1103
why = CLD_EXITED ;
@@ -1296,12 +1295,12 @@ static int wait_task_stopped(struct wait_opts *wo,
1296
1295
why = ptrace ? CLD_TRAPPED : CLD_STOPPED ;
1297
1296
read_unlock (& tasklist_lock );
1298
1297
sched_annotate_sleep ();
1298
+ if (wo -> wo_rusage )
1299
+ getrusage (p , RUSAGE_BOTH , wo -> wo_rusage );
1299
1300
1300
1301
if (unlikely (wo -> wo_flags & WNOWAIT ))
1301
1302
return wait_noreap_copyout (wo , p , pid , uid , why , exit_code );
1302
1303
1303
- if (wo -> wo_rusage )
1304
- getrusage (p , RUSAGE_BOTH , wo -> wo_rusage );
1305
1304
wo -> wo_stat = (exit_code << 8 ) | 0x7f ;
1306
1305
1307
1306
infop = wo -> wo_info ;
@@ -1350,10 +1349,10 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p)
1350
1349
get_task_struct (p );
1351
1350
read_unlock (& tasklist_lock );
1352
1351
sched_annotate_sleep ();
1352
+ if (wo -> wo_rusage )
1353
+ getrusage (p , RUSAGE_BOTH , wo -> wo_rusage );
1353
1354
1354
1355
if (!wo -> wo_info ) {
1355
- if (wo -> wo_rusage )
1356
- getrusage (p , RUSAGE_BOTH , wo -> wo_rusage );
1357
1356
put_task_struct (p );
1358
1357
wo -> wo_stat = 0xffff ;
1359
1358
retval = pid ;
0 commit comments