diff options
Diffstat (limited to 'kernel/taskstats.c')
-rw-r--r-- | kernel/taskstats.c | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 82ec9137d908..ea9506de3b85 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -18,13 +18,13 @@ | |||
18 | 18 | ||
19 | #include <linux/kernel.h> | 19 | #include <linux/kernel.h> |
20 | #include <linux/taskstats_kern.h> | 20 | #include <linux/taskstats_kern.h> |
21 | #include <linux/delayacct.h> | ||
21 | #include <net/genetlink.h> | 22 | #include <net/genetlink.h> |
22 | #include <asm/atomic.h> | 23 | #include <asm/atomic.h> |
23 | 24 | ||
24 | static DEFINE_PER_CPU(__u32, taskstats_seqnum) = { 0 }; | 25 | static DEFINE_PER_CPU(__u32, taskstats_seqnum) = { 0 }; |
25 | static int family_registered; | 26 | static int family_registered; |
26 | kmem_cache_t *taskstats_cache; | 27 | kmem_cache_t *taskstats_cache; |
27 | static DEFINE_MUTEX(taskstats_exit_mutex); | ||
28 | 28 | ||
29 | static struct genl_family family = { | 29 | static struct genl_family family = { |
30 | .id = GENL_ID_GENERATE, | 30 | .id = GENL_ID_GENERATE, |
@@ -120,7 +120,10 @@ static int fill_pid(pid_t pid, struct task_struct *pidtsk, | |||
120 | * goto err; | 120 | * goto err; |
121 | */ | 121 | */ |
122 | 122 | ||
123 | err: | 123 | rc = delayacct_add_tsk(stats, tsk); |
124 | stats->version = TASKSTATS_VERSION; | ||
125 | |||
126 | /* Define err: label here if needed */ | ||
124 | put_task_struct(tsk); | 127 | put_task_struct(tsk); |
125 | return rc; | 128 | return rc; |
126 | 129 | ||
@@ -152,8 +155,14 @@ static int fill_tgid(pid_t tgid, struct task_struct *tgidtsk, | |||
152 | * break; | 155 | * break; |
153 | */ | 156 | */ |
154 | 157 | ||
158 | rc = delayacct_add_tsk(stats, tsk); | ||
159 | if (rc) | ||
160 | break; | ||
161 | |||
155 | } while_each_thread(first, tsk); | 162 | } while_each_thread(first, tsk); |
156 | read_unlock(&tasklist_lock); | 163 | read_unlock(&tasklist_lock); |
164 | stats->version = TASKSTATS_VERSION; | ||
165 | |||
157 | 166 | ||
158 | /* | 167 | /* |
159 | * Accounting subsytems can also add calls here if they don't | 168 | * Accounting subsytems can also add calls here if they don't |
@@ -233,8 +242,6 @@ void taskstats_exit_send(struct task_struct *tsk, struct taskstats *tidstats, | |||
233 | if (!family_registered || !tidstats) | 242 | if (!family_registered || !tidstats) |
234 | return; | 243 | return; |
235 | 244 | ||
236 | mutex_lock(&taskstats_exit_mutex); | ||
237 | |||
238 | is_thread_group = !thread_group_empty(tsk); | 245 | is_thread_group = !thread_group_empty(tsk); |
239 | rc = 0; | 246 | rc = 0; |
240 | 247 | ||
@@ -292,7 +299,6 @@ nla_put_failure: | |||
292 | err_skb: | 299 | err_skb: |
293 | nlmsg_free(rep_skb); | 300 | nlmsg_free(rep_skb); |
294 | ret: | 301 | ret: |
295 | mutex_unlock(&taskstats_exit_mutex); | ||
296 | return; | 302 | return; |
297 | } | 303 | } |
298 | 304 | ||