Skip to content

Commit 1ab2785

Browse files
mjguzikbrauner
authored andcommitted
exit: perform add_device_randomness() without tasklist_lock
Parallel calls to add_device_randomness() contend on their own. The clone side aleady runs outside of tasklist_lock, which in turn means any caller on the exit side extends the tasklist_lock hold time while contending on the random-private lock. Reviewed-by: Oleg Nesterov <[email protected]> Signed-off-by: Mateusz Guzik <[email protected]> Link: https://lore.kernel.org/r/[email protected] Acked-by: "Liam R. Howlett" <[email protected]> Signed-off-by: Christian Brauner <[email protected]>
1 parent 33be3ff commit 1ab2785

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

kernel/exit.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -174,9 +174,6 @@ static void __exit_signal(struct task_struct *tsk)
174174
sig->curr_target = next_thread(tsk);
175175
}
176176

177-
add_device_randomness((const void*) &tsk->se.sum_exec_runtime,
178-
sizeof(unsigned long long));
179-
180177
/*
181178
* Accumulate here the counters for all threads as they die. We could
182179
* skip the group leader because it is the last user of signal_struct,
@@ -270,6 +267,8 @@ void release_task(struct task_struct *p)
270267
write_unlock_irq(&tasklist_lock);
271268
proc_flush_pid(thread_pid);
272269
put_pid(thread_pid);
270+
add_device_randomness(&p->se.sum_exec_runtime,
271+
sizeof(p->se.sum_exec_runtime));
273272
release_thread(p);
274273
/*
275274
* This task was already removed from the process/thread/pid lists

0 commit comments

Comments
 (0)