Commit 7d94dddd authored by Shailabh Nagar's avatar Shailabh Nagar Committed by Linus Torvalds

[PATCH] make taskstats sending completely independent of delay accounting on/off status

Complete the separation of delay accounting and taskstats by ignoring the
return value of delay accounting functions that fill in parts of taskstats
before it is sent out (either in response to a command or as part of a task
exit).

Also make delayacct_add_tsk return silently when delay accounting is turned
off rather than treat it as an error.
Signed-off-by: default avatarShailabh Nagar <nagar@watson.ibm.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 15a647eb
...@@ -80,9 +80,7 @@ static inline void delayacct_blkio_end(void) ...@@ -80,9 +80,7 @@ static inline void delayacct_blkio_end(void)
static inline int delayacct_add_tsk(struct taskstats *d, static inline int delayacct_add_tsk(struct taskstats *d,
struct task_struct *tsk) struct task_struct *tsk)
{ {
if (likely(!delayacct_on)) if (likely(!delayacct_on) || !tsk->delays)
return -EINVAL;
if (!tsk->delays)
return 0; return 0;
return __delayacct_add_tsk(d, tsk); return __delayacct_add_tsk(d, tsk);
} }
......
...@@ -177,7 +177,7 @@ static int send_cpu_listeners(struct sk_buff *skb, unsigned int cpu) ...@@ -177,7 +177,7 @@ static int send_cpu_listeners(struct sk_buff *skb, unsigned int cpu)
static int fill_pid(pid_t pid, struct task_struct *pidtsk, static int fill_pid(pid_t pid, struct task_struct *pidtsk,
struct taskstats *stats) struct taskstats *stats)
{ {
int rc; int rc = 0;
struct task_struct *tsk = pidtsk; struct task_struct *tsk = pidtsk;
if (!pidtsk) { if (!pidtsk) {
...@@ -196,12 +196,10 @@ static int fill_pid(pid_t pid, struct task_struct *pidtsk, ...@@ -196,12 +196,10 @@ static int fill_pid(pid_t pid, struct task_struct *pidtsk,
* Each accounting subsystem adds calls to its functions to * Each accounting subsystem adds calls to its functions to
* fill in relevant parts of struct taskstsats as follows * fill in relevant parts of struct taskstsats as follows
* *
* rc = per-task-foo(stats, tsk); * per-task-foo(stats, tsk);
* if (rc)
* goto err;
*/ */
rc = delayacct_add_tsk(stats, tsk); delayacct_add_tsk(stats, tsk);
stats->version = TASKSTATS_VERSION; stats->version = TASKSTATS_VERSION;
/* Define err: label here if needed */ /* Define err: label here if needed */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment