diff options
author | Pavel Emelyanov <xemul@openvz.org> | 2008-04-30 03:54:23 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-04-30 11:29:48 -0400 |
commit | cb41d6d068716b2b3666925da34d3d7e658bf4f3 (patch) | |
tree | 75926ace2cf9793a6b3809da2d6fb5813b1c9068 | |
parent | b7127aa4547d8cc8a5b569631e2b6ef613af1bb7 (diff) |
Use find_task_by_vpid in taskstats
The pid to lookup a task by is passed inside taskstats code via genetlink
message.
Since netlink packets are now processed in the context of the sending task,
this is correct to lookup the task with find_task_by_vpid() here.
Besides, I fix the call to fill_pid() from taskstats_exit(), since the
tsk->pid is not required in fill_pid() in this case, and the pid field on
task_struct is going to be deprecated as well.
Signed-off-by: Pavel Emelyanov <xemul@openvz.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Balbir Singh <balbir@in.ibm.com>
Cc: Jay Lan <jlan@engr.sgi.com>
Cc: Jonathan Lim <jlim@sgi.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r-- | kernel/taskstats.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 07e86a828073..4a23517169a6 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -183,7 +183,7 @@ static int fill_pid(pid_t pid, struct task_struct *tsk, | |||
183 | 183 | ||
184 | if (!tsk) { | 184 | if (!tsk) { |
185 | rcu_read_lock(); | 185 | rcu_read_lock(); |
186 | tsk = find_task_by_pid(pid); | 186 | tsk = find_task_by_vpid(pid); |
187 | if (tsk) | 187 | if (tsk) |
188 | get_task_struct(tsk); | 188 | get_task_struct(tsk); |
189 | rcu_read_unlock(); | 189 | rcu_read_unlock(); |
@@ -230,7 +230,7 @@ static int fill_tgid(pid_t tgid, struct task_struct *first, | |||
230 | */ | 230 | */ |
231 | rcu_read_lock(); | 231 | rcu_read_lock(); |
232 | if (!first) | 232 | if (!first) |
233 | first = find_task_by_pid(tgid); | 233 | first = find_task_by_vpid(tgid); |
234 | 234 | ||
235 | if (!first || !lock_task_sighand(first, &flags)) | 235 | if (!first || !lock_task_sighand(first, &flags)) |
236 | goto out; | 236 | goto out; |
@@ -547,7 +547,7 @@ void taskstats_exit(struct task_struct *tsk, int group_dead) | |||
547 | if (!stats) | 547 | if (!stats) |
548 | goto err; | 548 | goto err; |
549 | 549 | ||
550 | rc = fill_pid(tsk->pid, tsk, stats); | 550 | rc = fill_pid(-1, tsk, stats); |
551 | if (rc < 0) | 551 | if (rc < 0) |
552 | goto err; | 552 | goto err; |
553 | 553 | ||