OSDN Git Service

android: binder: Change binder mutex to rtmutex.
authorRiley Andrews <riandrews@google.com>
Sat, 27 Sep 2014 00:36:36 +0000 (17:36 -0700)
committerChih-Wei Huang <cwhuang@linux.org.tw>
Mon, 13 Apr 2015 16:43:08 +0000 (00:43 +0800)
Surfaceflinger uses binder heavily to receive/send frames from applications
while compositing the screen. Change the binder mutex to an rt mutex to minimize
instances where high priority surfaceflinger binder work is blocked by lower
priority binder ipc.

Change-Id: If7429040641d6e463f20301ec14f02ecf6b0da36
Signed-off-by: Riley Andrews <riandrews@google.com>
drivers/android/binder.c

index de14814..fa5344c 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/miscdevice.h>
 #include <linux/mm.h>
 #include <linux/module.h>
+#include <linux/rtmutex.h>
 #include <linux/mutex.h>
 #include <linux/nsproxy.h>
 #include <linux/poll.h>
@@ -46,7 +47,7 @@
 #include <uapi/linux/android/binder.h>
 #include "binder_trace.h"
 
-static DEFINE_MUTEX(binder_main_lock);
+static DEFINE_RT_MUTEX(binder_main_lock);
 static DEFINE_MUTEX(binder_deferred_lock);
 static DEFINE_MUTEX(binder_mmap_lock);
 
@@ -426,14 +427,14 @@ static long task_close_fd(struct binder_proc *proc, unsigned int fd)
 static inline void binder_lock(const char *tag)
 {
        trace_binder_lock(tag);
-       mutex_lock(&binder_main_lock);
+       rt_mutex_lock(&binder_main_lock);
        trace_binder_locked(tag);
 }
 
 static inline void binder_unlock(const char *tag)
 {
        trace_binder_unlock(tag);
-       mutex_unlock(&binder_main_lock);
+       rt_mutex_unlock(&binder_main_lock);
 }
 
 static void binder_set_nice(long nice)