[PATCH -mm] Fix return value of delayacct_add_tsk()

From: Balbir Singh
Date: Wed Jun 07 2006 - 13:41:32 EST


Hi, Andrew,

This patch is to be applied on top of
per-task-delay-accounting-taskstats-interface-fix-2.patch

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 <balbir@xxxxxxxxxx>
Signed-off-by: Shailabh Nagar <nagar@xxxxxxxxxx>

---

include/linux/delayacct.h | 4 +++-
1 files changed, 3 insertions(+), 1 deletion(-)

diff -puN include/linux/delayacct.h~per-task-delay-accounting-taskstats-interface-fix-3 include/linux/delayacct.h
--- linux-2.6.17-rc5/include/linux/delayacct.h~per-task-delay-accounting-taskstats-interface-fix-3 2006-06-07 22:57:12.000000000 +0530
+++ linux-2.6.17-rc5-balbir/include/linux/delayacct.h 2006-06-07 22:57:39.000000000 +0530
@@ -80,8 +80,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);
}

_

--

Balbir Singh,
Linux Technology Center,
IBM Software Labs
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/