Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit babbdbff authored by Minchan Kim's avatar Minchan Kim Committed by android-build-merger
Browse files

Merge "Add system_server to system group only if per_app_memcg is true" into pi-dev am: fb11e4c9

am: 6614a086

Change-Id: Ie46e76f215dcb22b3d1eb4c0e9d19e8e49d4b715
parents 84c8b0fe 6614a086
Loading
Loading
Loading
Loading
+11 −5
Original line number Diff line number Diff line
@@ -45,6 +45,7 @@
#include <unistd.h>

#include "android-base/logging.h"
#include <android-base/properties.h>
#include <android-base/file.h>
#include <android-base/stringprintf.h>
#include <cutils/fs.h>
@@ -70,6 +71,7 @@ namespace {
using android::String8;
using android::base::StringPrintf;
using android::base::WriteStringToFile;
using android::base::GetBoolProperty;

#define CREATE_ERROR(...) StringPrintf("%s:%d: ", __FILE__, __LINE__). \
                              append(StringPrintf(__VA_ARGS__))
@@ -931,6 +933,9 @@ static jint com_android_internal_os_Zygote_nativeForkSystemServer(
          RuntimeAbort(env, __LINE__, "System server process has died. Restarting Zygote!");
      }

      bool low_ram_device = GetBoolProperty("ro.config.low_ram", false);
      bool per_app_memcg = GetBoolProperty("ro.config.per_app_memcg", low_ram_device);
      if (per_app_memcg) {
          // Assign system_server to the correct memory cgroup.
          // Not all devices mount /dev/memcg so check for the file first
          // to avoid unnecessarily printing errors and denials in the logs.
@@ -939,6 +944,7 @@ static jint com_android_internal_os_Zygote_nativeForkSystemServer(
              ALOGE("couldn't write %d to /dev/memcg/system/tasks", pid);
          }
      }
  }
  return pid;
}