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

Commit 6b1d5923 authored by Android Build Coastguard Worker's avatar Android Build Coastguard Worker
Browse files

Snap for 12482619 from 4aad973f to 25Q1-release

Change-Id: I8708699548037ab8791c71d6382d5b85c0fd2277
parents a1505378 4aad973f
Loading
Loading
Loading
Loading
+0 −3
Original line number Diff line number Diff line
@@ -538,12 +538,9 @@ Result<void> ServiceParser::ParseUser(std::vector<std::string>&& args) {
// when we migrate to cgroups v2 while these hardcoded paths stay the same.
static std::optional<const std::string> ConvertTaskFileToProfile(const std::string& file) {
    static const std::map<const std::string, const std::string> map = {
            {"/dev/stune/top-app/tasks", "MaxPerformance"},
            {"/dev/stune/foreground/tasks", "HighPerformance"},
            {"/dev/cpuset/camera-daemon/tasks", "CameraServiceCapacity"},
            {"/dev/cpuset/foreground/tasks", "ProcessCapacityHigh"},
            {"/dev/cpuset/system-background/tasks", "ServiceCapacityLow"},
            {"/dev/stune/nnapi-hal/tasks", "NNApiHALPerformance"},
            {"/dev/blkio/background/tasks", "LowIoPriority"},
    };
    auto iter = map.find(file);
+7 −25
Original line number Diff line number Diff line
@@ -203,33 +203,15 @@ bool SetClampsAction::ExecuteForTask(int) const {
// To avoid issues in sdk_mac build
#if defined(__ANDROID__)

bool SetTimerSlackAction::IsTimerSlackSupported(pid_t tid) {
    auto file = StringPrintf("/proc/%d/timerslack_ns", tid);

    return (access(file.c_str(), W_OK) == 0);
}

bool SetTimerSlackAction::ExecuteForTask(pid_t tid) const {
    static bool sys_supports_timerslack = IsTimerSlackSupported(tid);

    // v4.6+ kernels support the /proc/<tid>/timerslack_ns interface.
    // TODO: once we've backported this, log if the open(2) fails.
    if (sys_supports_timerslack) {
        auto file = StringPrintf("/proc/%d/timerslack_ns", tid);
    const auto file = StringPrintf("/proc/%d/timerslack_ns", tid);
    if (!WriteStringToFile(std::to_string(slack_), file)) {
        if (errno == ENOENT) {
            // This happens when process is already dead
            return true;
        }
        PLOG(ERROR) << "set_timerslack_ns write failed";
        }
    }

    // TODO: Remove when /proc/<tid>/timerslack_ns interface is backported.
    if (tid == 0 || tid == GetThreadId()) {
        if (prctl(PR_SET_TIMERSLACK, slack_) == -1) {
            PLOG(ERROR) << "set_timerslack_ns prctl failed";
        }
        return false;
    }

    return true;
+1 −3
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ class ProfileAction {

    // Default implementations will fail
    virtual bool ExecuteForProcess(uid_t, pid_t) const { return false; }
    virtual bool ExecuteForTask(int) const { return false; }
    virtual bool ExecuteForTask(pid_t) const { return false; }
    virtual bool ExecuteForUID(uid_t) const { return false; }

    virtual void EnableResourceCaching(ResourceCacheType) {}
@@ -114,8 +114,6 @@ class SetTimerSlackAction : public ProfileAction {

  private:
    unsigned long slack_;

    static bool IsTimerSlackSupported(pid_t tid);
};

// Set attribute profile element
+0 −49
Original line number Diff line number Diff line
@@ -112,37 +112,6 @@ on init
    # Create socket dir for ot-daemon
    mkdir /dev/socket/ot-daemon 0770 thread_network thread_network

    # Create energy-aware scheduler tuning nodes
    mkdir /dev/stune/foreground
    mkdir /dev/stune/background
    mkdir /dev/stune/top-app
    mkdir /dev/stune/rt
    chown system system /dev/stune
    chown system system /dev/stune/foreground
    chown system system /dev/stune/background
    chown system system /dev/stune/top-app
    chown system system /dev/stune/rt
    chown system system /dev/stune/tasks
    chown system system /dev/stune/foreground/tasks
    chown system system /dev/stune/background/tasks
    chown system system /dev/stune/top-app/tasks
    chown system system /dev/stune/rt/tasks
    chown system system /dev/stune/cgroup.procs
    chown system system /dev/stune/foreground/cgroup.procs
    chown system system /dev/stune/background/cgroup.procs
    chown system system /dev/stune/top-app/cgroup.procs
    chown system system /dev/stune/rt/cgroup.procs
    chmod 0664 /dev/stune/tasks
    chmod 0664 /dev/stune/foreground/tasks
    chmod 0664 /dev/stune/background/tasks
    chmod 0664 /dev/stune/top-app/tasks
    chmod 0664 /dev/stune/rt/tasks
    chmod 0664 /dev/stune/cgroup.procs
    chmod 0664 /dev/stune/foreground/cgroup.procs
    chmod 0664 /dev/stune/background/cgroup.procs
    chmod 0664 /dev/stune/top-app/cgroup.procs
    chmod 0664 /dev/stune/rt/cgroup.procs

    # cpuctl hierarchy for devices using utilclamp
    mkdir /dev/cpuctl/foreground
    mkdir /dev/cpuctl/foreground_window
@@ -216,24 +185,6 @@ on init
    chmod 0664 /dev/cpuctl/camera-daemon/tasks
    chmod 0664 /dev/cpuctl/camera-daemon/cgroup.procs

    # Create an stune group for camera-specific processes
    mkdir /dev/stune/camera-daemon
    chown system system /dev/stune/camera-daemon
    chown system system /dev/stune/camera-daemon/tasks
    chown system system /dev/stune/camera-daemon/cgroup.procs
    chmod 0664 /dev/stune/camera-daemon/tasks
    chmod 0664 /dev/stune/camera-daemon/cgroup.procs

    # Create an stune group for NNAPI HAL processes
    mkdir /dev/stune/nnapi-hal
    chown system system /dev/stune/nnapi-hal
    chown system system /dev/stune/nnapi-hal/tasks
    chown system system /dev/stune/nnapi-hal/cgroup.procs
    chmod 0664 /dev/stune/nnapi-hal/tasks
    chmod 0664 /dev/stune/nnapi-hal/cgroup.procs
    write /dev/stune/nnapi-hal/schedtune.boost 1
    write /dev/stune/nnapi-hal/schedtune.prefer_idle 1

    # Create blkio group and apply initial settings.
    # This feature needs kernel to support it, and the
    # device's init.rc must actually set the correct values.