From: Balbir Singh Currently fill_tgid() fails if any thread in a thread_group has a missing delays structure. This behaviour is incorrect in the case when a thread group leader exits before any of the other threads in the group. The leader continues to be examined but has a null tsk->delays struct. The correct behaviour is to skip threads with a null delays struct and continue accumulating delay accounting statistics for the other threads. The patch also adds an explicit check for delay accounting being on since presence or absence of tsk->delays struct is no longer an equivalent check. Signed-off-by: Balbir Singh Signed-off-by: Shailabh Nagar Signed-off-by: Andrew Morton --- include/linux/delayacct.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff -puN include/linux/delayacct.h~per-task-delay-accounting-delay-accounting-usage-of-taskstats-interface-fix-return-value-of-delayacct_add_tsk include/linux/delayacct.h --- devel/include/linux/delayacct.h~per-task-delay-accounting-delay-accounting-usage-of-taskstats-interface-fix-return-value-of-delayacct_add_tsk 2006-06-07 23:56:54.000000000 -0700 +++ devel-akpm/include/linux/delayacct.h 2006-06-07 23:56:54.000000000 -0700 @@ -79,8 +79,10 @@ static inline void delayacct_blkio_end(v static inline int delayacct_add_tsk(struct taskstats *d, struct task_struct *tsk) { - if (!tsk->delays) + if (likely(!delayacct_on)) return -EINVAL; + if (!tsk->delays) + return 0; return __delayacct_add_tsk(d, tsk); } _