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

Commit 82b72a56 authored by Suren Baghdasaryan's avatar Suren Baghdasaryan Committed by Colin Cross
Browse files

libprocessgroup: Add support for task profiles



Abstract usage of cgroups into task profiles that allows for changes
in cgroup hierarchy and version without affecting framework codebase.
Rework current processgroup and sched_policy API function implementations
to use task profiles instead of hardcoded paths and attributes.
Mount cgroups using information from cgroups.json rather than from init.rc

Exempt-From-Owner-Approval: already approved in internal master

Bug: 111307099
Test: builds, boots

Change-Id: If5532d6dc570add825cebd5b5148e00c7d688e32
Merged-In: If5532d6dc570add825cebd5b5148e00c7d688e32
Signed-off-by: default avatarSuren Baghdasaryan <surenb@google.com>
parent 503cf84f
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -109,6 +109,7 @@ CHARGER_STATIC_LIBRARIES := \
    libbase \
    libutils \
    libcutils \
    libjsoncpp \
    libprocessgroup \
    liblog \
    libm \
+1 −1
Original line number Diff line number Diff line
@@ -60,7 +60,6 @@ cc_defaults {
    },
    static_libs: [
        "libseccomp_policy",
        "libprocessgroup",
        "libavb",
        "libprotobuf-cpp-lite",
        "libpropertyinfoserializer",
@@ -82,6 +81,7 @@ cc_defaults {
        "liblog",
        "liblogwrap",
        "liblp",
        "libprocessgroup",
        "libselinux",
        "libutils",
    ],
+14 −0
Original line number Diff line number Diff line
@@ -42,6 +42,7 @@
#include <fs_mgr_vendor_overlay.h>
#include <keyutils.h>
#include <libavb/libavb.h>
#include <processgroup/processgroup.h>
#include <selinux/android.h>

#ifndef RECOVERY
@@ -347,6 +348,17 @@ static Result<Success> console_init_action(const BuiltinArguments& args) {
    return Success();
}

static Result<Success> SetupCgroupsAction(const BuiltinArguments&) {
    // Have to create <CGROUPS_RC_DIR> using make_dir function
    // for appropriate sepolicy to be set for it
    make_dir(CGROUPS_RC_DIR, 0711);
    if (!CgroupSetupCgroups()) {
        return ErrnoError() << "Failed to setup cgroups";
    }

    return Success();
}

static void import_kernel_nv(const std::string& key, const std::string& value, bool for_emulator) {
    if (key.empty()) return;

@@ -682,6 +694,8 @@ int SecondStageMain(int argc, char** argv) {
    // Nexus 9 boot time, so it's disabled by default.
    if (false) DumpState();

    am.QueueBuiltinAction(SetupCgroupsAction, "SetupCgroups");

    am.QueueEventTrigger("early-init");

    // Queue an action that waits for coldboot done so we know ueventd has set up all of /dev...
+1 −0
Original line number Diff line number Diff line
@@ -59,6 +59,7 @@ test_libraries = [
    "libcutils",
    "liblog",
    "libbase",
    "libjsoncpp",
    "libprocessgroup",
]

+3 −1
Original line number Diff line number Diff line
@@ -16,8 +16,10 @@ cc_library_headers {

cc_library {
    srcs: [
        "cgroup_map.cpp",
        "processgroup.cpp",
        "sched_policy.cpp",
        "task_profiles.cpp",
    ],
    name: "libprocessgroup",
    host_supported: true,
@@ -29,7 +31,7 @@ cc_library {
    },
    shared_libs: [
        "libbase",
        "liblog",
        "libjsoncpp",
    ],
    // for cutils/android_filesystem_config.h
    header_libs: [
Loading