diff --git a/drivers/android/binder.c b/drivers/android/binder.c index 2bb7f52b14f6..723e2780933d 100644 --- a/drivers/android/binder.c +++ b/drivers/android/binder.c @@ -648,10 +648,11 @@ static int to_kernel_prio(int policy, int user_priority) return MAX_USER_RT_PRIO - 1 - user_priority; } -static void binder_do_set_priority(struct task_struct *task, +static void binder_do_set_priority(struct binder_thread *thread, const struct binder_priority *desired, bool verify) { + struct task_struct *task = thread->task; int priority; /* user-space prio value */ bool has_cap_nice; unsigned int policy = desired->sched_policy; @@ -711,22 +712,23 @@ static void binder_do_set_priority(struct task_struct *task, set_user_nice(task, priority); } -static void binder_set_priority(struct task_struct *task, +static void binder_set_priority(struct binder_thread *thread, const struct binder_priority *desired) { - binder_do_set_priority(task, desired, /* verify = */ true); + binder_do_set_priority(thread, desired, /* verify = */ true); } -static void binder_restore_priority(struct task_struct *task, +static void binder_restore_priority(struct binder_thread *thread, const struct binder_priority *desired) { - binder_do_set_priority(task, desired, /* verify = */ false); + binder_do_set_priority(thread, desired, /* verify = */ false); } -static void binder_transaction_priority(struct task_struct *task, +static void binder_transaction_priority(struct binder_thread *thread, struct binder_transaction *t, struct binder_node *node) { + struct task_struct *task = thread->task; struct binder_priority desired = t->priority; const struct binder_priority node_prio = { .sched_policy = node->sched_policy, @@ -763,7 +765,7 @@ static void binder_transaction_priority(struct task_struct *task, desired = node_prio; } - binder_set_priority(task, &desired); + binder_set_priority(thread, &desired); trace_android_vh_binder_set_priority(t, task); } @@ -2516,7 +2518,7 @@ static int binder_proc_transaction(struct binder_transaction *t, thread ? thread->task : 0, node->debug_id, t->code, pending_async); if (thread) { - binder_transaction_priority(thread->task, t, node); + binder_transaction_priority(thread, t, node); binder_enqueue_thread_work_ilocked(thread, &t->work); } else if (!pending_async) { binder_enqueue_work_ilocked(&t->work, &proc->todo); @@ -3212,7 +3214,7 @@ static void binder_transaction(struct binder_proc *proc, binder_inner_proc_unlock(target_proc); wake_up_interruptible_sync(&target_thread->wait); trace_android_vh_binder_restore_priority(in_reply_to, current); - binder_restore_priority(current, &in_reply_to->saved_priority); + binder_restore_priority(thread, &in_reply_to->saved_priority); binder_free_transaction(in_reply_to); } else if (!(t->flags & TF_ONE_WAY)) { BUG_ON(t->buffer->async_transaction != 0); @@ -3326,7 +3328,7 @@ err_invalid_target_handle: BUG_ON(thread->return_error.cmd != BR_OK); if (in_reply_to) { trace_android_vh_binder_restore_priority(in_reply_to, current); - binder_restore_priority(current, &in_reply_to->saved_priority); + binder_restore_priority(thread, &in_reply_to->saved_priority); thread->return_error.cmd = BR_TRANSACTION_COMPLETE; binder_enqueue_thread_work(thread, &thread->return_error.work); binder_send_failed_reply(in_reply_to, return_error); @@ -4005,7 +4007,7 @@ retry: binder_stop_on_user_error < 2); } trace_android_vh_binder_restore_priority(NULL, current); - binder_restore_priority(current, &proc->default_priority); + binder_restore_priority(thread, &proc->default_priority); } if (non_block) { @@ -4235,7 +4237,7 @@ retry: trd->target.ptr = target_node->ptr; trd->cookie = target_node->cookie; - binder_transaction_priority(current, t, target_node); + binder_transaction_priority(thread, t, target_node); cmd = BR_TRANSACTION; } else { trd->target.ptr = 0;