ANDROID: binder: Add vendor hook to fix priority restore
When cpu loading is high, the task maybe preempted after restoring the
sched priority in trace_android_vh_binder_free_buf(). This means that
node->has_async_transaction can't be cleared immediately and the work
isn't added to the proc->todo queue as soon as possible.
To fix this we add a new hook trace_android_vh_binder_buffer_release()
to restore the priority after node->has_async_transaction has been
updated and the node->work has been added to the proc->todo queue.
Note: the old trace_android_vh_binder_free_buf() hook is kept to avoid
breaking KMI but is not extrictly needed.
Bug: 327307900
Fixes: 0eb66ec39ca8 ("ANDROID: vendor_hooks: Add hooks for binder")
Change-Id: I8126c79c9c68faa3ce0cd87ce83e2591bd61d5dd
Signed-off-by: Fuchun Liao <lfc@oppo.com>
[cmllamas: fix-up commit log and variable naming]
Signed-off-by: Carlos Llamas <cmllamas@google.com>
This commit is contained in:
parent
c73814520d
commit
56e0cf4e39
3 changed files with 9 additions and 0 deletions
|
|
@ -3989,12 +3989,14 @@ binder_free_buf(struct binder_proc *proc,
|
||||||
struct binder_buffer *buffer, bool is_failure)
|
struct binder_buffer *buffer, bool is_failure)
|
||||||
{
|
{
|
||||||
bool enqueue_task = true;
|
bool enqueue_task = true;
|
||||||
|
bool has_transaction = false;
|
||||||
|
|
||||||
trace_android_vh_binder_free_buf(proc, thread, buffer);
|
trace_android_vh_binder_free_buf(proc, thread, buffer);
|
||||||
binder_inner_proc_lock(proc);
|
binder_inner_proc_lock(proc);
|
||||||
if (buffer->transaction) {
|
if (buffer->transaction) {
|
||||||
buffer->transaction->buffer = NULL;
|
buffer->transaction->buffer = NULL;
|
||||||
buffer->transaction = NULL;
|
buffer->transaction = NULL;
|
||||||
|
has_transaction = true;
|
||||||
}
|
}
|
||||||
binder_inner_proc_unlock(proc);
|
binder_inner_proc_unlock(proc);
|
||||||
if (buffer->async_transaction && buffer->target_node) {
|
if (buffer->async_transaction && buffer->target_node) {
|
||||||
|
|
@ -4018,6 +4020,8 @@ binder_free_buf(struct binder_proc *proc,
|
||||||
}
|
}
|
||||||
binder_node_inner_unlock(buf_node);
|
binder_node_inner_unlock(buf_node);
|
||||||
}
|
}
|
||||||
|
trace_android_vh_binder_buffer_release(proc, thread, buffer,
|
||||||
|
has_transaction);
|
||||||
trace_binder_transaction_buffer_release(buffer);
|
trace_binder_transaction_buffer_release(buffer);
|
||||||
binder_release_entire_buffer(proc, thread, buffer, is_failure);
|
binder_release_entire_buffer(proc, thread, buffer, is_failure);
|
||||||
binder_alloc_free_buf(&proc->alloc, buffer);
|
binder_alloc_free_buf(&proc->alloc, buffer);
|
||||||
|
|
|
||||||
|
|
@ -353,6 +353,7 @@ EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_transaction_received);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_oem_binder_struct);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_free_oem_binder_struct);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_special_task);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_special_task);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_free_buf);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_free_buf);
|
||||||
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_binder_buffer_release);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_compaction_exit);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_compaction_exit);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_compaction_try_to_compact_pages_exit);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_compaction_try_to_compact_pages_exit);
|
||||||
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_alloc_pages_direct_reclaim_enter);
|
EXPORT_TRACEPOINT_SYMBOL_GPL(android_vh_mm_alloc_pages_direct_reclaim_enter);
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,10 @@ DECLARE_HOOK(android_vh_binder_free_buf,
|
||||||
TP_PROTO(struct binder_proc *proc, struct binder_thread *thread,
|
TP_PROTO(struct binder_proc *proc, struct binder_thread *thread,
|
||||||
struct binder_buffer *buffer),
|
struct binder_buffer *buffer),
|
||||||
TP_ARGS(proc, thread, buffer));
|
TP_ARGS(proc, thread, buffer));
|
||||||
|
DECLARE_HOOK(android_vh_binder_buffer_release,
|
||||||
|
TP_PROTO(struct binder_proc *proc, struct binder_thread *thread,
|
||||||
|
struct binder_buffer *buffer, bool has_transaction),
|
||||||
|
TP_ARGS(proc, thread, buffer, has_transaction));
|
||||||
|
|
||||||
DECLARE_HOOK(android_vh_binder_ioctl_end,
|
DECLARE_HOOK(android_vh_binder_ioctl_end,
|
||||||
TP_PROTO(struct task_struct *caller_task,
|
TP_PROTO(struct task_struct *caller_task,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue