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

Commit 4284f9f3 authored by Tim Murray's avatar Tim Murray
Browse files

Improve cpuset support for surfaceflinger.

SurfaceFlinger needs some of its threads in the system-background cpuset
and some of its threads (the binder pool) outside of the
system-background cpuset in order to improve UI perf/power
consumption. Remove surfaceflinger from the system-background cpuset in
init.rc and allow a thread to place itself in the system-background
cpuset given enough permissions.

bug 25745866

Change-Id: I85f7e41c5439e6ad7cc2d355e51f5dfb3a0c7088
parent 3b299d55
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -62,6 +62,7 @@ static int fg_cgroup_fd = -1;

#ifdef USE_CPUSETS
// File descriptors open to /dev/cpuset/../tasks, setup by initialize, or -1 on error
static int system_bg_cpuset_fd = -1;
static int bg_cpuset_fd = -1;
static int fg_cpuset_fd = -1;
static int bg_schedboost_fd = -1;
@@ -130,6 +131,9 @@ static void __initialize(void) {
        fg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
        filename = "/dev/cpuset/background/tasks";
        bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);
        filename = "/dev/cpuset/system-background/tasks";
        system_bg_cpuset_fd = open(filename, O_WRONLY | O_CLOEXEC);

#ifdef USE_SCHEDBOOST
        filename = "/sys/fs/cgroup/stune/foreground/tasks";
        fg_schedboost_fd = open(filename, O_WRONLY | O_CLOEXEC);
@@ -138,7 +142,6 @@ static void __initialize(void) {
#endif
    }
#endif

}

/*
@@ -273,6 +276,10 @@ int set_cpuset_policy(int tid, SchedPolicy policy)
        fd = fg_cpuset_fd;
        boost_fd = fg_schedboost_fd;
        break;
    case SP_SYSTEM:
        fd = system_bg_cpuset_fd;
        boost_fd = bg_schedboost_fd;
        break;
    default:
        boost_fd = fd = -1;
        break;
+4 −0
Original line number Diff line number Diff line
@@ -180,6 +180,10 @@ on init
    chown system system /dev/cpuset/foreground/boost/tasks
    chown system system /dev/cpuset/background/tasks
    chown system system /dev/cpuset/system-background/tasks

    # set system-background to 0775 so SurfaceFlinger can touch it
    chmod 0775 /dev/cpuset/system-background

    chmod 0664 /dev/cpuset/foreground/tasks
    chmod 0664 /dev/cpuset/foreground/boost/tasks
    chmod 0664 /dev/cpuset/background/tasks