Re: posix-cpu-timers revamp

Frank Mayhar
2008-04-02T21:43:14Z

On Wed, 2008-04-02 at 13:34 -0700, Frank Mayhar wrote:
> One little gotcha we just ran into, though: When checking
> tsk->signal->(anything) in run_posix_cpu_timers(), we have to hold
> tasklist_lock to avoid a race with release_task(). This is going to
> make even the null case always cost more than before.

This race, by the way, is because we're dereferencing task->signal at
interrupt once per tick. We ran into a case where a process was going
through release_task() and being torn down on one CPU while running a
timer tick on another. Under load. It's not a very likely race but
with sufficient time or load it's pretty much inevitable.

My thought is to move thread_group_cputime from the signal structure to
hanging directly off the task structure. It would be shared in the same
way as the signal structure is now but would be deallocated with the
task structure rather than the signal structure. This should mean that
I could avoid getting tasklist_lock under most conditions.

Thoughts?