diff options
author | Mike Rapoport <rppt@linux.vnet.ibm.com> | 2018-02-07 00:40:17 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2018-02-07 03:32:46 +0100 |
commit | 2ee0826085d1c0281cb60c1f4bc3e0c27efeedc3 (patch) | |
tree | bb2dc8915be7e4f0fea7438edf380d84b896f80a /kernel/taskstats.c | |
parent | drivers/rapidio/devices/tsi721_dma.c: adjust six checks for null pointers (diff) | |
download | linux-2ee0826085d1c0281cb60c1f4bc3e0c27efeedc3.tar.xz linux-2ee0826085d1c0281cb60c1f4bc3e0c27efeedc3.zip |
pids: introduce find_get_task_by_vpid() helper
There are several functions that do find_task_by_vpid() followed by
get_task_struct(). We can use a helper function instead.
Link: http://lkml.kernel.org/r/1509602027-11337-1-git-send-email-rppt@linux.vnet.ibm.com
Signed-off-by: Mike Rapoport <rppt@linux.vnet.ibm.com>
Acked-by: Oleg Nesterov <oleg@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'kernel/taskstats.c')
-rw-r--r-- | kernel/taskstats.c | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 4559e914452b..4e62a4a8fa91 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -194,11 +194,7 @@ static int fill_stats_for_pid(pid_t pid, struct taskstats *stats) { struct task_struct *tsk; - rcu_read_lock(); - tsk = find_task_by_vpid(pid); - if (tsk) - get_task_struct(tsk); - rcu_read_unlock(); + tsk = find_get_task_by_vpid(pid); if (!tsk) return -ESRCH; fill_stats(current_user_ns(), task_active_pid_ns(current), tsk, stats); |