mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-25 20:10:23 +09:00
ANDROID: binder: switch task argument for binder_thread
Refactor binder priority functions to take in 'struct binder_thread *'
instead of just 'struct task_struct *'. This allows access to other
thread fields used in subsequent patches. In any case, the same task
reference is still available under thread->task.
There is no functional impact from this patch.
Bug: 148101660
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Change-Id: I67b599884580d957d776500e467827e5035c99f6
(cherry picked from commit 759d98484b)
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user