Skip to content

Commit 2b5fe6d

Browse files
oleg-nesterovIngo Molnar
authored andcommitted
thread_group_cputime: move a couple of callsites outside of ->siglock
Impact: relax the locking of cpu-time accounting calls ->siglock buys nothing for thread_group_cputime() in do_sys_times() and wait_task_zombie() (which btw takes the unrelated parent's ->siglock). Actually I think do_sys_times() doesn't need ->siglock at all. Signed-off-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
1 parent ce39447 commit 2b5fe6d

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎kernel/exit.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1330,10 +1330,10 @@ static int wait_task_zombie(struct task_struct *p, int options,
13301330
* group, which consolidates times for all threads in the
13311331
* group including the group leader.
13321332
*/
1333+
thread_group_cputime(p, &cputime);
13331334
spin_lock_irq(&p->parent->sighand->siglock);
13341335
psig = p->parent->signal;
13351336
sig = p->signal;
1336-
thread_group_cputime(p, &cputime);
13371337
psig->cutime =
13381338
cputime_add(psig->cutime,
13391339
cputime_add(cputime.utime,

‎kernel/sys.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -858,8 +858,8 @@ void do_sys_times(struct tms *tms)
858858
struct task_cputime cputime;
859859
cputime_t cutime, cstime;
860860

861-
spin_lock_irq(&current->sighand->siglock);
862861
thread_group_cputime(current, &cputime);
862+
spin_lock_irq(&current->sighand->siglock);
863863
cutime = current->signal->cutime;
864864
cstime = current->signal->cstime;
865865
spin_unlock_irq(&current->sighand->siglock);

0 commit comments

Comments
 (0)