ANDROID: binder: fix minimum node priority comparison

The "desired" priority for a transaction can be adjusted depending on
various factors. For instance, it might be set to SCHED_NORMAL 120, when
the caller is RT and the target node has !inherit_rt.

However, instead of using these adjustments, the existing logic compares
the minimum node priority against the original transaction priority.
If the transaction priority is "higher", then the minimum node priority
is ignored. This is particularly a problem when the "desired" priority
has been changed to SCHED_NORMAL.

This patch corrects the logic, comparing the minimum node priority
against the (potentially adjusted) "desired" priority. This guarantees
that the node's minimum priority is honored.

Bug: 417382411
Cc: Martijn Coenen <maco@google.com>
Fixes: c46810c23565 ("ANDROID: binder: add RT inheritance flag to node.")
Change-Id: I813073241b996c1c38c29f20849b247023697102
Signed-off-by: zhanghao56 <zhanghao56@xiaomi.corp-partner.google.com>
Signed-off-by: Carlos Llamas <cmllamas@google.com>
This commit is contained in:
zhanghao56
2025-05-13 16:23:13 +08:00
committed by Carlos Llamas
parent ed212f01bf
commit 9ba0b26f62

View File

@@ -827,8 +827,8 @@ static void binder_transaction_priority(struct binder_thread *thread,
desired.sched_policy = SCHED_NORMAL;
}
if (node_prio.prio < t->priority.prio ||
(node_prio.prio == t->priority.prio &&
if (node_prio.prio < desired.prio ||
(node_prio.prio == desired.prio &&
node_prio.sched_policy == SCHED_FIFO)) {
/*
* In case the minimum priority on the node is