mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
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/[email protected] Signed-off-by: Mike Rapoport <[email protected]> Acked-by: Oleg Nesterov <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
parent
eab216e9cc
commit
2ee0826085
8 changed files with 33 additions and 68 deletions
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue