Skip to content

Commit 3f883f9

Browse files
Martijn Coenenpundiramit
authored andcommitted
ANDROID: binder: clarify deferred thread work.
Rename the function to more accurately reflect what it does, and add a comment explaining why we use it. Change-Id: I8d011c017dfc6e24b5b54fc462578f8e153e5926 Signed-off-by: Martijn Coenen <maco@android.com>
1 parent 942b151 commit 3f883f9

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

drivers/android/binder.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ binder_enqueue_work_ilocked(struct binder_work *work,
837837
}
838838

839839
/**
840-
* binder_enqueue_thread_work_ilocked_nowake() - Add thread work
840+
* binder_enqueue_deferred_thread_work_ilocked() - Add deferred thread work
841841
* @thread: thread to queue work to
842842
* @work: struct binder_work to add to list
843843
*
@@ -848,8 +848,8 @@ binder_enqueue_work_ilocked(struct binder_work *work,
848848
* Requires the proc->inner_lock to be held.
849849
*/
850850
static void
851-
binder_enqueue_thread_work_ilocked_nowake(struct binder_thread *thread,
852-
struct binder_work *work)
851+
binder_enqueue_deferred_thread_work_ilocked(struct binder_thread *thread,
852+
struct binder_work *work)
853853
{
854854
binder_enqueue_work_ilocked(work, &thread->todo);
855855
}
@@ -3334,7 +3334,14 @@ static void binder_transaction(struct binder_proc *proc,
33343334
} else if (!(t->flags & TF_ONE_WAY)) {
33353335
BUG_ON(t->buffer->async_transaction != 0);
33363336
binder_inner_proc_lock(proc);
3337-
binder_enqueue_thread_work_ilocked_nowake(thread, tcomplete);
3337+
/*
3338+
* Defer the TRANSACTION_COMPLETE, so we don't return to
3339+
* userspace immediately; this allows the target process to
3340+
* immediately start processing this transaction, reducing
3341+
* latency. We will then return the TRANSACTION_COMPLETE when
3342+
* the target replies (or there is an error).
3343+
*/
3344+
binder_enqueue_deferred_thread_work_ilocked(thread, tcomplete);
33383345
t->need_reply = 1;
33393346
t->from_parent = thread->transaction_stack;
33403347
thread->transaction_stack = t;

0 commit comments

Comments
 (0)