[PATCH] fix task struct refcount bug
From: Manfred Spraul <manfred@colorfullife.com> (We think this might be the mystery bug which has been hanging about for months) We found a [the?] task struct refcount error: A task that dies sets tsk->state to TASK_ZOMBIE. The next scheduled task checks prev->state, and if it's ZOMBIE, then it decrements the reference count of prev. The prev->state & _ZOMBIE test is not atomic with schedule, thus if prev is scheduled again and dies between dropping the runqueue lock and checking prev->state, then the reference it dropped twice. This is possible with either preemption [schedule_tail is called by ret_from_fork with preemption count 1, finish_arch_switch drops it to 0] or profiling [profile_exit_mmap can sleep on profile_rwsem, called by mmdrop()] enabled.
Showing
Please register or sign in to comment