Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2b5fe6de authored by Oleg Nesterov's avatar Oleg Nesterov Committed by Ingo Molnar
Browse files

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: default avatarOleg Nesterov <oleg@redhat.com>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent ce394471
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1330,10 +1330,10 @@ static int wait_task_zombie(struct task_struct *p, int options,
		 * group, which consolidates times for all threads in the
		 * group including the group leader.
		 */
		thread_group_cputime(p, &cputime);
		spin_lock_irq(&p->parent->sighand->siglock);
		psig = p->parent->signal;
		sig = p->signal;
		thread_group_cputime(p, &cputime);
		psig->cutime =
			cputime_add(psig->cutime,
			cputime_add(cputime.utime,
+1 −1
Original line number Diff line number Diff line
@@ -858,8 +858,8 @@ void do_sys_times(struct tms *tms)
	struct task_cputime cputime;
	cputime_t cutime, cstime;

	spin_lock_irq(&current->sighand->siglock);
	thread_group_cputime(current, &cputime);
	spin_lock_irq(&current->sighand->siglock);
	cutime = current->signal->cutime;
	cstime = current->signal->cstime;
	spin_unlock_irq(&current->sighand->siglock);