ANDROID: binder: Switch binder_deferred_lock to a spinlock.
Avoid delays in binder transactions due to preemption of binder_deferred_func() with binder_deferred_lock held. Bug: 66914906 Test: boots; binder tests pass; trace analysis in bug Change-Id: I1a89ba15b27e43552890292f135a5e2d969231e2 Signed-off-by: Corey Tabaka <eieio@google.com>
This commit is contained in:
@@ -47,7 +47,7 @@
|
||||
#include "binder_trace.h"
|
||||
|
||||
static HLIST_HEAD(binder_deferred_list);
|
||||
static DEFINE_MUTEX(binder_deferred_lock);
|
||||
static DEFINE_SPINLOCK(binder_deferred_lock);
|
||||
|
||||
static HLIST_HEAD(binder_devices);
|
||||
static HLIST_HEAD(binder_procs);
|
||||
@@ -4599,7 +4599,7 @@ static void binder_deferred_func(struct work_struct *work)
|
||||
int defer;
|
||||
|
||||
do {
|
||||
mutex_lock(&binder_deferred_lock);
|
||||
spin_lock(&binder_deferred_lock);
|
||||
if (!hlist_empty(&binder_deferred_list)) {
|
||||
proc = hlist_entry(binder_deferred_list.first,
|
||||
struct binder_proc, deferred_work_node);
|
||||
@@ -4610,7 +4610,7 @@ static void binder_deferred_func(struct work_struct *work)
|
||||
proc = NULL;
|
||||
defer = 0;
|
||||
}
|
||||
mutex_unlock(&binder_deferred_lock);
|
||||
spin_unlock(&binder_deferred_lock);
|
||||
|
||||
if (defer & BINDER_DEFERRED_PUT_FILES) {
|
||||
binder_proc_lock(proc, __LINE__);
|
||||
@@ -4639,14 +4639,14 @@ static DECLARE_WORK(binder_deferred_work, binder_deferred_func);
|
||||
static void
|
||||
binder_defer_work(struct binder_proc *proc, enum binder_deferred_state defer)
|
||||
{
|
||||
mutex_lock(&binder_deferred_lock);
|
||||
spin_lock(&binder_deferred_lock);
|
||||
proc->deferred_work |= defer;
|
||||
if (hlist_unhashed(&proc->deferred_work_node)) {
|
||||
hlist_add_head(&proc->deferred_work_node,
|
||||
&binder_deferred_list);
|
||||
queue_work(binder_deferred_workqueue, &binder_deferred_work);
|
||||
}
|
||||
mutex_unlock(&binder_deferred_lock);
|
||||
spin_unlock(&binder_deferred_lock);
|
||||
}
|
||||
|
||||
static void _print_binder_transaction(struct seq_file *m,
|
||||
|
||||
Reference in New Issue
Block a user