mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-08 03:40:35 +09:00
ANDROID: binder: fold common setup of node_prio
The setup of node_prio is always the same, so just fold this logic into
binder_transaction_priority() to avoid duplication. Let's pass the node
reference instead, which also gives access to node->inherit_rt.
There is no functional impact from this patch.
Bug: 148101660
Signed-off-by: Carlos Llamas <cmllamas@google.com>
Change-Id: Ib390204556e69c4bc8492cd9cd873773f9cdce42
(cherry picked from commit 498bf715b7)
[cmllamas: fixed conflict with vendor hook patch]
This commit is contained in:
@@ -725,10 +725,13 @@ static void binder_restore_priority(struct task_struct *task,
|
|||||||
|
|
||||||
static void binder_transaction_priority(struct task_struct *task,
|
static void binder_transaction_priority(struct task_struct *task,
|
||||||
struct binder_transaction *t,
|
struct binder_transaction *t,
|
||||||
struct binder_priority node_prio,
|
struct binder_node *node)
|
||||||
bool inherit_rt)
|
|
||||||
{
|
{
|
||||||
struct binder_priority desired_prio = t->priority;
|
struct binder_priority desired_prio = t->priority;
|
||||||
|
const struct binder_priority node_prio = {
|
||||||
|
.sched_policy = node->sched_policy,
|
||||||
|
.prio = node->min_priority,
|
||||||
|
};
|
||||||
bool skip = false;
|
bool skip = false;
|
||||||
|
|
||||||
if (t->set_priority_called)
|
if (t->set_priority_called)
|
||||||
@@ -742,7 +745,7 @@ static void binder_transaction_priority(struct task_struct *task,
|
|||||||
if (skip)
|
if (skip)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!inherit_rt && is_rt_policy(desired_prio.sched_policy)) {
|
if (!node->inherit_rt && is_rt_policy(desired_prio.sched_policy)) {
|
||||||
desired_prio.prio = NICE_TO_PRIO(0);
|
desired_prio.prio = NICE_TO_PRIO(0);
|
||||||
desired_prio.sched_policy = SCHED_NORMAL;
|
desired_prio.sched_policy = SCHED_NORMAL;
|
||||||
}
|
}
|
||||||
@@ -2479,14 +2482,11 @@ static int binder_proc_transaction(struct binder_transaction *t,
|
|||||||
struct binder_thread *thread)
|
struct binder_thread *thread)
|
||||||
{
|
{
|
||||||
struct binder_node *node = t->buffer->target_node;
|
struct binder_node *node = t->buffer->target_node;
|
||||||
struct binder_priority node_prio;
|
|
||||||
bool oneway = !!(t->flags & TF_ONE_WAY);
|
bool oneway = !!(t->flags & TF_ONE_WAY);
|
||||||
bool pending_async = false;
|
bool pending_async = false;
|
||||||
|
|
||||||
BUG_ON(!node);
|
BUG_ON(!node);
|
||||||
binder_node_lock(node);
|
binder_node_lock(node);
|
||||||
node_prio.prio = node->min_priority;
|
|
||||||
node_prio.sched_policy = node->sched_policy;
|
|
||||||
|
|
||||||
if (oneway) {
|
if (oneway) {
|
||||||
BUG_ON(thread);
|
BUG_ON(thread);
|
||||||
@@ -2516,8 +2516,7 @@ static int binder_proc_transaction(struct binder_transaction *t,
|
|||||||
thread ? thread->task : 0, node->debug_id, t->code, pending_async);
|
thread ? thread->task : 0, node->debug_id, t->code, pending_async);
|
||||||
|
|
||||||
if (thread) {
|
if (thread) {
|
||||||
binder_transaction_priority(thread->task, t, node_prio,
|
binder_transaction_priority(thread->task, t, node);
|
||||||
node->inherit_rt);
|
|
||||||
binder_enqueue_thread_work_ilocked(thread, &t->work);
|
binder_enqueue_thread_work_ilocked(thread, &t->work);
|
||||||
} else if (!pending_async) {
|
} else if (!pending_async) {
|
||||||
binder_enqueue_work_ilocked(&t->work, &proc->todo);
|
binder_enqueue_work_ilocked(&t->work, &proc->todo);
|
||||||
@@ -4233,14 +4232,10 @@ retry:
|
|||||||
BUG_ON(t->buffer == NULL);
|
BUG_ON(t->buffer == NULL);
|
||||||
if (t->buffer->target_node) {
|
if (t->buffer->target_node) {
|
||||||
struct binder_node *target_node = t->buffer->target_node;
|
struct binder_node *target_node = t->buffer->target_node;
|
||||||
struct binder_priority node_prio;
|
|
||||||
|
|
||||||
trd->target.ptr = target_node->ptr;
|
trd->target.ptr = target_node->ptr;
|
||||||
trd->cookie = target_node->cookie;
|
trd->cookie = target_node->cookie;
|
||||||
node_prio.sched_policy = target_node->sched_policy;
|
binder_transaction_priority(current, t, target_node);
|
||||||
node_prio.prio = target_node->min_priority;
|
|
||||||
binder_transaction_priority(current, t, node_prio,
|
|
||||||
target_node->inherit_rt);
|
|
||||||
cmd = BR_TRANSACTION;
|
cmd = BR_TRANSACTION;
|
||||||
} else {
|
} else {
|
||||||
trd->target.ptr = 0;
|
trd->target.ptr = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user