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

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

Snap for 12870242 from 51febf46 to 25Q2-release

Change-Id: Id88c4761d5becb34954bdadbefa9c17a94b680a8
parents dbd52e59 51febf46
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -39,11 +39,13 @@ TEST(init, oneshot_on) {

    // Bootanim exits quickly when the device is fully booted, so check that it goes back to the
    // 'restarting' state that non-oneshot services enter once they've restarted.
    EXPECT_TRUE(WaitForProperty("init.svc.bootanim", "restarting", 10s));
    EXPECT_TRUE(WaitForProperty("init.svc.bootanim", "restarting", 10s))
            << "Value is: " << GetProperty("init.svc.bootanim", "");

    SetProperty("ctl.oneshot_on", "bootanim");
    SetProperty("ctl.start", "bootanim");

    // Now that oneshot is enabled again, bootanim should transition into the 'stopped' state.
    EXPECT_TRUE(WaitForProperty("init.svc.bootanim", "stopped", 10s));
    EXPECT_TRUE(WaitForProperty("init.svc.bootanim", "stopped", 10s))
            << "Value is: " << GetProperty("init.svc.bootanim", "");
}
+0 −6
Original line number Diff line number Diff line
@@ -7,7 +7,6 @@ soong_config_module_type {
    module_type: "cc_defaults",
    config_namespace: "ANDROID",
    bool_variables: [
        "memcg_v2_force_enabled",
        "cgroup_v2_sys_app_isolation",
    ],
    properties: [
@@ -19,11 +18,6 @@ libprocessgroup_flag_aware_cc_defaults {
    name: "libprocessgroup_build_flags_cc",
    cpp_std: "gnu++23",
    soong_config_variables: {
        memcg_v2_force_enabled: {
            cflags: [
                "-DMEMCG_V2_FORCE_ENABLED=true",
            ],
        },
        cgroup_v2_sys_app_isolation: {
            cflags: [
                "-DCGROUP_V2_SYS_APP_ISOLATION=true",
+0 −8
Original line number Diff line number Diff line
@@ -16,20 +16,12 @@

#pragma once

#ifndef MEMCG_V2_FORCE_ENABLED
#define MEMCG_V2_FORCE_ENABLED false
#endif

#ifndef CGROUP_V2_SYS_APP_ISOLATION
#define CGROUP_V2_SYS_APP_ISOLATION false
#endif

namespace android::libprocessgroup_flags {

inline consteval bool force_memcg_v2() {
    return MEMCG_V2_FORCE_ENABLED;
}

inline consteval bool cgroup_v2_sys_app_isolation() {
    return CGROUP_V2_SYS_APP_ISOLATION;
}
+0 −47
Original line number Diff line number Diff line
@@ -27,9 +27,6 @@
#include <sys/types.h>
#include <unistd.h>

#include <optional>

#include <android-base/file.h>
#include <android-base/logging.h>
#include <processgroup/cgroup_descriptor.h>
#include <processgroup/processgroup.h>
@@ -260,39 +257,6 @@ void CgroupDescriptor::set_mounted(bool mounted) {
    controller_.set_flags(flags);
}

static std::optional<bool> MGLRUDisabled() {
    const std::string file_name = "/sys/kernel/mm/lru_gen/enabled";
    std::string content;
    if (!android::base::ReadFileToString(file_name, &content)) {
        PLOG(ERROR) << "Failed to read MGLRU state from " << file_name;
        return {};
    }

    return content == "0x0000";
}

static std::optional<bool> MEMCGDisabled(const CgroupDescriptorMap& descriptors) {
    std::string cgroup_v2_root = CGROUP_V2_ROOT_DEFAULT;
    const auto it = descriptors.find(CGROUPV2_HIERARCHY_NAME);
    if (it == descriptors.end()) {
        LOG(WARNING) << "No Cgroups2 path found in cgroups.json. Vendor has modified Android, and "
                     << "kernel memory use will be higher than intended.";
    } else if (it->second.controller()->path() != cgroup_v2_root) {
        cgroup_v2_root = it->second.controller()->path();
    }

    const std::string file_name = cgroup_v2_root + "/cgroup.controllers";
    std::string content;
    if (!android::base::ReadFileToString(file_name, &content)) {
        PLOG(ERROR) << "Failed to read cgroup controllers from " << file_name;
        return {};
    }

    // If we've forced memcg to v2 and it's not available, then it could only have been disabled
    // on the kernel command line (GKI sets CONFIG_MEMCG).
    return content.find("memory") == std::string::npos;
}

static bool CreateV2SubHierarchy(const std::string& path, const CgroupDescriptorMap& descriptors) {
    const auto cgv2_iter = descriptors.find(CGROUPV2_HIERARCHY_NAME);
    if (cgv2_iter == descriptors.end()) return false;
@@ -335,17 +299,6 @@ bool CgroupSetup() {
        }
    }

    if (android::libprocessgroup_flags::force_memcg_v2()) {
        if (MGLRUDisabled().value_or(false)) {
            LOG(WARNING) << "Memcg forced to v2 hierarchy with MGLRU disabled! "
                         << "Global reclaim performance will suffer.";
        }
        if (MEMCGDisabled(descriptors).value_or(false)) {
            LOG(WARNING) << "Memcg forced to v2 hierarchy while memcg is disabled by kernel "
                         << "command line!";
        }
    }

    // System / app isolation.
    // This really belongs in early-init in init.rc, but we cannot use the flag there.
    if (android::libprocessgroup_flags::cgroup_v2_sys_app_isolation()) {
+1 −1
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ package {

cc_library_static {
    name: "libprocessgroup_util",
    cpp_std: "gnu++23",
    vendor_available: true,
    product_available: true,
    ramdisk_available: true,
@@ -47,7 +48,6 @@ cc_library_static {
    static_libs: [
        "libjsoncpp",
    ],
    defaults: ["libprocessgroup_build_flags_cc"],
}

cc_test {
Loading