ANDROID: binder: clarify deferred thread work.
authorMartijn Coenen <maco@android.com>
Mon, 13 Nov 2017 08:55:21 +0000 (09:55 +0100)
committerAmit Pundir <amit.pundir@linaro.org>
Mon, 18 Dec 2017 15:41:22 +0000 (21:11 +0530)
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>
drivers/android/binder.c

index 6d946d1fa433403abde86d75419c5ae89cb94973..9298002dda2aa50fe28a242d48b14751b1764a1e 100644 (file)
@@ -836,7 +836,7 @@ binder_enqueue_work_ilocked(struct binder_work *work,
 }
 
 /**
- * binder_enqueue_thread_work_ilocked_nowake() - Add thread work
+ * binder_enqueue_deferred_thread_work_ilocked() - Add deferred thread work
  * @thread:       thread to queue work to
  * @work:         struct binder_work to add to list
  *
@@ -847,8 +847,8 @@ binder_enqueue_work_ilocked(struct binder_work *work,
  * Requires the proc->inner_lock to be held.
  */
 static void
-binder_enqueue_thread_work_ilocked_nowake(struct binder_thread *thread,
-                                         struct binder_work *work)
+binder_enqueue_deferred_thread_work_ilocked(struct binder_thread *thread,
+                                           struct binder_work *work)
 {
        binder_enqueue_work_ilocked(work, &thread->todo);
 }
@@ -3332,7 +3332,14 @@ static void binder_transaction(struct binder_proc *proc,
        } else if (!(t->flags & TF_ONE_WAY)) {
                BUG_ON(t->buffer->async_transaction != 0);
                binder_inner_proc_lock(proc);
-               binder_enqueue_thread_work_ilocked_nowake(thread, tcomplete);
+               /*
+                * Defer the TRANSACTION_COMPLETE, so we don't return to
+                * userspace immediately; this allows the target process to
+                * immediately start processing this transaction, reducing
+                * latency. We will then return the TRANSACTION_COMPLETE when
+                * the target replies (or there is an error).
+                */
+               binder_enqueue_deferred_thread_work_ilocked(thread, tcomplete);
                t->need_reply = 1;
                t->from_parent = thread->transaction_stack;
                thread->transaction_stack = t;