OSDN Git Service

Revert "Add boost to increase the load on newly-forked zygote processes."
authorTodd Kjos <tkjos@google.com>
Wed, 7 Sep 2016 01:25:46 +0000 (18:25 -0700)
committerAndreas Gampe <agampe@google.com>
Fri, 16 Dec 2016 17:05:50 +0000 (09:05 -0800)
This reverts commit 6d43a861d01ef48f37c69f96346a13d23164a585.

(cherry picked from commit 0f2ded62ae3d88ddb732df182c3bfee3e2729018)

Test: m
Test: Device boots
Change-Id: I627e47c6ead4ce2d2bffa923a32a56d06c022df7

core/jni/Android.mk
core/jni/com_android_internal_os_Zygote.cpp

index 5fcde8b..70e9004 100644 (file)
@@ -20,10 +20,6 @@ ifneq ($(ENABLE_CPUSETS),)
     LOCAL_CFLAGS += -DENABLE_CPUSETS
 endif
 
-ifneq ($(ENABLE_SCHED_BOOST),)
-    LOCAL_CFLAGS += -DENABLE_SCHED_BOOST
-endif
-
 LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES
 
 LOCAL_CFLAGS += -DU_USING_ICU_NAMESPACE=0
index d081549..9c74d9a 100644 (file)
@@ -418,27 +418,6 @@ void SetThreadName(const char* thread_name) {
   }
 }
 
-#ifdef ENABLE_SCHED_BOOST
-static void SetForkLoad(bool boost) {
-  // set scheduler knob to boost forked processes
-  pid_t currentPid = getpid();
-  // fits at most "/proc/XXXXXXX/sched_init_task_load\0"
-  char schedPath[35];
-  snprintf(schedPath, sizeof(schedPath), "/proc/%u/sched_init_task_load", currentPid);
-  int schedBoostFile = open(schedPath, O_WRONLY);
-  if (schedBoostFile < 0) {
-    ALOGW("Unable to set zygote scheduler boost");
-    return;
-  }
-  if (boost) {
-    write(schedBoostFile, "100\0", 4);
-  } else {
-    write(schedBoostFile, "0\0", 2);
-  }
-  close(schedBoostFile);
-}
-#endif
-
 // The list of open zygote file descriptors.
 static FileDescriptorTable* gOpenFdTable = NULL;
 
@@ -452,10 +431,6 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra
                                      jstring instructionSet, jstring dataDir) {
   SetSigChldHandler();
 
-#ifdef ENABLE_SCHED_BOOST
-  SetForkLoad(true);
-#endif
-
   // Close any logging related FDs before we start evaluating the list of
   // file descriptors.
   __android_log_close();
@@ -614,12 +589,6 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra
     }
   } else if (pid > 0) {
     // the parent process
-
-#ifdef ENABLE_SCHED_BOOST
-    // unset scheduler knob
-    SetForkLoad(false);
-#endif
-
   }
   return pid;
 }