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>
This commit is contained in:

committed by
Linus Torvalds

parent
eab216e9cc
commit
2ee0826085
@@ -2610,17 +2610,10 @@ pfm_get_task(pfm_context_t *ctx, pid_t pid, struct task_struct **task)
|
||||
if (pid < 2) return -EPERM;
|
||||
|
||||
if (pid != task_pid_vnr(current)) {
|
||||
|
||||
read_lock(&tasklist_lock);
|
||||
|
||||
p = find_task_by_vpid(pid);
|
||||
|
||||
/* make sure task cannot go away while we operate on it */
|
||||
if (p) get_task_struct(p);
|
||||
|
||||
read_unlock(&tasklist_lock);
|
||||
|
||||
if (p == NULL) return -ESRCH;
|
||||
p = find_get_task_by_vpid(pid);
|
||||
if (!p)
|
||||
return -ESRCH;
|
||||
}
|
||||
|
||||
ret = pfm_task_incompatible(ctx, p);
|
||||
|
Reference in New Issue
Block a user