Skip to contentSkip to conversation

timer: Check thread timers only when there are active thread timers

PATCH George Spelvin 2 participants 2 messages Aug 26, 2015

lore
Share & tools
lore
#0 lore raw

- check_thread_timers(tsk, &firing);
+ if (!task_cputime_zero(&tsk->cputime_expires))
+ check_thread_timers(tsk, &firing);

Sincere question; I'm not certain myself: would it make more sense to put this shortcut into check_thread_timers()?

It seems more like an optimization of that function than something the caller needs to know about.

#1 lore raw
Quoted 9 lines · George Spelvin
(quoted diff) +2 -1
-	check_thread_timers(tsk, &firing);
+	if (!task_cputime_zero(&tsk->cputime_expires))
+		check_thread_timers(tsk, &firing);

Sincere question; I'm not certain myself: would it make more sense to put this shortcut into check_thread_timers()?

It seems more like an optimization of that function than something the caller needs to know about.

Yes, I also thought it might be better if we add something like:

	if (task_cputime_zero(&tsk->cputime_expires)
		return;

in check_thread_timers(). The reason I made it this way though is because in the next few lines, we do a similar check before calling check_process_timers(), and I wanted to keep things consistent.

However, perhaps we can consider also moving that tsk->signal->cputimer.running check into check_process_timers() too.

Thanks for the suggestions.