Merge "Change owner of ACPI BERT tables to system" into main
diff --git a/fs_mgr/libsnapshot/android/snapshot/snapshot.proto b/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
index 62f9901..5fb71a3 100644
--- a/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
+++ b/fs_mgr/libsnapshot/android/snapshot/snapshot.proto
@@ -233,6 +233,8 @@
// Number of cow operations to be merged at once
uint32 cow_op_merge_size = 13;
+ // Number of worker threads to serve I/O from dm-user
+ uint32 num_worker_threads = 14;
}
// Next: 10
diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h
index 7ae55db..8ff41db 100644
--- a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h
+++ b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h
@@ -838,6 +838,10 @@
// Get value of maximum cow op merge size
uint32_t GetUpdateCowOpMergeSize(LockedFile* lock);
+
+ // Get number of threads to perform post OTA boot verification
+ uint32_t GetUpdateWorkerCount(LockedFile* lock);
+
// Wrapper around libdm, with diagnostics.
bool DeleteDeviceIfExists(const std::string& name,
const std::chrono::milliseconds& timeout_ms = {});
diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp
index 6c3bedd..05dec68 100644
--- a/fs_mgr/libsnapshot/snapshot.cpp
+++ b/fs_mgr/libsnapshot/snapshot.cpp
@@ -1235,8 +1235,8 @@
wrong_phase = true;
break;
default:
- LOG(ERROR) << "Unknown merge status for \"" << snapshot << "\": "
- << "\"" << result.state << "\"";
+ LOG(ERROR) << "Unknown merge status for \"" << snapshot << "\": " << "\""
+ << result.state << "\"";
if (failure_code == MergeFailureCode::Ok) {
failure_code = MergeFailureCode::UnexpectedMergeState;
}
@@ -1725,6 +1725,10 @@
if (cow_op_merge_size != 0) {
snapuserd_argv->emplace_back("-cow_op_merge_size=" + std::to_string(cow_op_merge_size));
}
+ uint32_t worker_count = GetUpdateWorkerCount(lock.get());
+ if (worker_count != 0) {
+ snapuserd_argv->emplace_back("-worker_count=" + std::to_string(worker_count));
+ }
}
size_t num_cows = 0;
@@ -2152,6 +2156,11 @@
return update_status.cow_op_merge_size();
}
+uint32_t SnapshotManager::GetUpdateWorkerCount(LockedFile* lock) {
+ SnapshotUpdateStatus update_status = ReadSnapshotUpdateStatus(lock);
+ return update_status.num_worker_threads();
+}
+
bool SnapshotManager::MarkSnapuserdFromSystem() {
auto path = GetSnapuserdFromSystemPath();
@@ -3140,6 +3149,7 @@
status.set_legacy_snapuserd(old_status.legacy_snapuserd());
status.set_o_direct(old_status.o_direct());
status.set_cow_op_merge_size(old_status.cow_op_merge_size());
+ status.set_num_worker_threads(old_status.num_worker_threads());
}
return WriteSnapshotUpdateStatus(lock, status);
}
@@ -3524,6 +3534,9 @@
}
status.set_cow_op_merge_size(
android::base::GetUintProperty<uint32_t>("ro.virtual_ab.cow_op_merge_size", 0));
+ status.set_num_worker_threads(
+ android::base::GetUintProperty<uint32_t>("ro.virtual_ab.num_worker_threads", 0));
+
} else if (legacy_compression) {
LOG(INFO) << "Virtual A/B using legacy snapuserd";
} else {
@@ -3960,6 +3973,7 @@
ss << "Using io_uring: " << update_status.io_uring_enabled() << std::endl;
ss << "Using o_direct: " << update_status.o_direct() << std::endl;
ss << "Cow op merge size (0 for uncapped): " << update_status.cow_op_merge_size() << std::endl;
+ ss << "Worker thread count: " << update_status.num_worker_threads() << std::endl;
ss << "Using XOR compression: " << GetXorCompressionEnabledProperty() << std::endl;
ss << "Current slot: " << device_->GetSlotSuffix() << std::endl;
ss << "Boot indicator: booting from " << GetCurrentSlot() << " slot" << std::endl;
@@ -4576,8 +4590,7 @@
}
}
- LOG(ERROR) << "Device-mapper device " << name << "(" << full_path << ")"
- << " still in use."
+ LOG(ERROR) << "Device-mapper device " << name << "(" << full_path << ")" << " still in use."
<< " Probably a file descriptor was leaked or held open, or a loop device is"
<< " attached.";
return false;
diff --git a/fs_mgr/libsnapshot/snapuserd/snapuserd_daemon.cpp b/fs_mgr/libsnapshot/snapuserd/snapuserd_daemon.cpp
index dd2dd56..32e16cc 100644
--- a/fs_mgr/libsnapshot/snapuserd/snapuserd_daemon.cpp
+++ b/fs_mgr/libsnapshot/snapuserd/snapuserd_daemon.cpp
@@ -31,6 +31,7 @@
DEFINE_bool(io_uring, false, "If true, io_uring feature is enabled");
DEFINE_bool(o_direct, false, "If true, enable direct reads on source device");
DEFINE_int32(cow_op_merge_size, 0, "number of operations to be processed at once");
+DEFINE_int32(worker_count, 4, "number of worker threads used to serve I/O requests to dm-user");
namespace android {
namespace snapshot {
@@ -114,8 +115,9 @@
LOG(ERROR) << "Malformed message, expected at least four sub-arguments.";
return false;
}
- auto handler = user_server_.AddHandler(parts[0], parts[1], parts[2], parts[3],
- FLAGS_o_direct, FLAGS_cow_op_merge_size);
+ auto handler =
+ user_server_.AddHandler(parts[0], parts[1], parts[2], parts[3], FLAGS_worker_count,
+ FLAGS_o_direct, FLAGS_cow_op_merge_size);
if (!handler || !user_server_.StartHandler(parts[0])) {
return false;
}
diff --git a/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.cpp b/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.cpp
index 013df35..3bb8a30 100644
--- a/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.cpp
+++ b/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.cpp
@@ -35,6 +35,7 @@
#include <snapuserd/dm_user_block_server.h>
#include <snapuserd/snapuserd_client.h>
#include "snapuserd_server.h"
+#include "user-space-merge/snapuserd_core.h"
namespace android {
namespace snapshot {
@@ -125,7 +126,7 @@
return Sendmsg(fd, "fail");
}
- auto handler = AddHandler(out[1], out[2], out[3], out[4]);
+ auto handler = AddHandler(out[1], out[2], out[3], out[4], std::nullopt);
if (!handler) {
return Sendmsg(fd, "fail");
}
@@ -341,12 +342,11 @@
SetTerminating();
}
-std::shared_ptr<HandlerThread> UserSnapshotServer::AddHandler(const std::string& misc_name,
- const std::string& cow_device_path,
- const std::string& backing_device,
- const std::string& base_path_merge,
- const bool o_direct,
- uint32_t cow_op_merge_size) {
+std::shared_ptr<HandlerThread> UserSnapshotServer::AddHandler(
+ const std::string& misc_name, const std::string& cow_device_path,
+ const std::string& backing_device, const std::string& base_path_merge,
+ std::optional<uint32_t> num_worker_threads, const bool o_direct,
+ uint32_t cow_op_merge_size) {
// We will need multiple worker threads only during
// device boot after OTA. For all other purposes,
// one thread is sufficient. We don't want to consume
@@ -355,7 +355,9 @@
//
// During boot up, we need multiple threads primarily for
// update-verification.
- int num_worker_threads = kNumWorkerThreads;
+ if (!num_worker_threads.has_value()) {
+ num_worker_threads = kNumWorkerThreads;
+ }
if (is_socket_present_) {
num_worker_threads = 1;
}
@@ -368,7 +370,7 @@
auto opener = block_server_factory_->CreateOpener(misc_name);
return handlers_->AddHandler(misc_name, cow_device_path, backing_device, base_path_merge,
- opener, num_worker_threads, io_uring_enabled_, o_direct,
+ opener, num_worker_threads.value(), io_uring_enabled_, o_direct,
cow_op_merge_size);
}
diff --git a/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.h b/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.h
index ceea36a..f002e8d 100644
--- a/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.h
+++ b/fs_mgr/libsnapshot/snapuserd/user-space-merge/snapuserd_server.h
@@ -87,6 +87,7 @@
const std::string& cow_device_path,
const std::string& backing_device,
const std::string& base_path_merge,
+ std::optional<uint32_t> num_worker_threads,
bool o_direct = false,
uint32_t cow_op_merge_size = 0);
bool StartHandler(const std::string& misc_name);
diff --git a/init/block_dev_initializer.cpp b/init/block_dev_initializer.cpp
index 8f52158..cabeb01 100644
--- a/init/block_dev_initializer.cpp
+++ b/init/block_dev_initializer.cpp
@@ -98,7 +98,11 @@
LOG(VERBOSE) << __PRETTY_FUNCTION__ << ": found partition: " << name;
- devices->erase(iter);
+ // Remove partition from the list only if it was found on boot device
+ if (device_handler_->IsBootDevice(uevent)) {
+ devices->erase(iter);
+ }
+
device_handler_->HandleUevent(uevent);
return devices->empty() ? ListenerAction::kStop : ListenerAction::kContinue;
}
diff --git a/init/devices.cpp b/init/devices.cpp
index f2bb9d2..6a3a64d 100644
--- a/init/devices.cpp
+++ b/init/devices.cpp
@@ -188,6 +188,28 @@
}
}
+bool DeviceHandler::IsBootDevice(const Uevent& uevent) const {
+ std::string device;
+
+ if (FindPlatformDevice(uevent.path, &device)) {
+ // Skip /devices/platform or /devices/ if present
+ static constexpr std::string_view devices_platform_prefix = "/devices/platform/";
+ static constexpr std::string_view devices_prefix = "/devices/";
+
+ if (StartsWith(device, devices_platform_prefix)) {
+ device = device.substr(devices_platform_prefix.length());
+ } else if (StartsWith(device, devices_prefix)) {
+ device = device.substr(devices_prefix.length());
+ }
+ } else if (FindPciDevicePrefix(uevent.path, &device)) {
+ } else if (FindVbdDevicePrefix(uevent.path, &device)) {
+ } else {
+ return false;
+ }
+
+ return boot_devices_.find(device) != boot_devices_.end();
+}
+
std::string DeviceHandler::GetPartitionNameForDevice(const std::string& query_device) {
static const auto partition_map = [] {
std::vector<std::pair<std::string, std::string>> partition_map;
diff --git a/init/devices.h b/init/devices.h
index 6da1232..4df604d 100644
--- a/init/devices.h
+++ b/init/devices.h
@@ -133,6 +133,7 @@
// `androidboot.partition_map=vdb,metadata;vdc,userdata` maps `vdb` to `metadata` and `vdc` to
// `userdata`.
static std::string GetPartitionNameForDevice(const std::string& device);
+ bool IsBootDevice(const Uevent& uevent) const;
private:
void ColdbootDone() override;
diff --git a/libcutils/sched_policy_test.cpp b/libcutils/sched_policy_test.cpp
index 50bd6d0..2641743 100644
--- a/libcutils/sched_policy_test.cpp
+++ b/libcutils/sched_policy_test.cpp
@@ -67,13 +67,6 @@
}
TEST(SchedPolicy, set_sched_policy) {
- if (!schedboost_enabled()) {
- // schedboost_enabled() (i.e. CONFIG_CGROUP_SCHEDTUNE) is optional;
- // it's only needed on devices using energy-aware scheduler.
- GTEST_LOG_(INFO) << "skipping test that requires CONFIG_CGROUP_SCHEDTUNE";
- return;
- }
-
ASSERT_EQ(0, set_sched_policy(0, SP_BACKGROUND));
ASSERT_EQ(0, set_cpuset_policy(0, SP_BACKGROUND));
AssertPolicy(SP_BACKGROUND);
diff --git a/libprocessgroup/include/processgroup/sched_policy.h b/libprocessgroup/include/processgroup/sched_policy.h
index 1b6ea66..92cd367 100644
--- a/libprocessgroup/include/processgroup/sched_policy.h
+++ b/libprocessgroup/include/processgroup/sched_policy.h
@@ -29,14 +29,6 @@
*/
extern bool cpusets_enabled();
-/*
- * Check if Linux kernel enables SCHEDTUNE feature (only available in Android
- * common kernel or Linaro LSK, not in mainline Linux as of v4.9)
- *
- * Return value: 1 if Linux kernel CONFIG_CGROUP_SCHEDTUNE=y; 0 otherwise.
- */
-extern bool schedboost_enabled();
-
/* Keep in sync with THREAD_GROUP_* in frameworks/base/core/java/android/os/Process.java */
typedef enum {
SP_DEFAULT = -1,
diff --git a/libprocessgroup/profiles/Android.bp b/libprocessgroup/profiles/Android.bp
index 885971a..1ec9f7f 100644
--- a/libprocessgroup/profiles/Android.bp
+++ b/libprocessgroup/profiles/Android.bp
@@ -19,11 +19,6 @@
prebuilt_etc {
name: "cgroups.json",
src: "cgroups.json",
- required: [
- "cgroups_28.json",
- "cgroups_29.json",
- "cgroups_30.json",
- ],
}
prebuilt_etc {
@@ -34,49 +29,8 @@
}
prebuilt_etc {
- name: "cgroups_28.json",
- src: "cgroups_28.json",
- sub_dir: "task_profiles",
-}
-
-prebuilt_etc {
- name: "cgroups_29.json",
- src: "cgroups_29.json",
- sub_dir: "task_profiles",
-}
-
-prebuilt_etc {
- name: "cgroups_30.json",
- src: "cgroups_30.json",
- sub_dir: "task_profiles",
-}
-
-prebuilt_etc {
name: "task_profiles.json",
src: "task_profiles.json",
- required: [
- "task_profiles_28.json",
- "task_profiles_29.json",
- "task_profiles_30.json",
- ],
-}
-
-prebuilt_etc {
- name: "task_profiles_28.json",
- src: "task_profiles_28.json",
- sub_dir: "task_profiles",
-}
-
-prebuilt_etc {
- name: "task_profiles_29.json",
- src: "task_profiles_29.json",
- sub_dir: "task_profiles",
-}
-
-prebuilt_etc {
- name: "task_profiles_30.json",
- src: "task_profiles_30.json",
- sub_dir: "task_profiles",
}
cc_defaults {
diff --git a/libprocessgroup/profiles/cgroups_28.json b/libprocessgroup/profiles/cgroups_28.json
deleted file mode 100644
index 17d4929..0000000
--- a/libprocessgroup/profiles/cgroups_28.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "Cgroups": [
- {
- "Controller": "schedtune",
- "Path": "/dev/stune",
- "Mode": "0755",
- "UID": "system",
- "GID": "system"
- }
- ]
-}
diff --git a/libprocessgroup/profiles/cgroups_29.json b/libprocessgroup/profiles/cgroups_29.json
deleted file mode 100644
index 17d4929..0000000
--- a/libprocessgroup/profiles/cgroups_29.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "Cgroups": [
- {
- "Controller": "schedtune",
- "Path": "/dev/stune",
- "Mode": "0755",
- "UID": "system",
- "GID": "system"
- }
- ]
-}
diff --git a/libprocessgroup/profiles/cgroups_30.json b/libprocessgroup/profiles/cgroups_30.json
deleted file mode 100644
index 80a074b..0000000
--- a/libprocessgroup/profiles/cgroups_30.json
+++ /dev/null
@@ -1,12 +0,0 @@
-{
- "Cgroups": [
- {
- "Controller": "schedtune",
- "Path": "/dev/stune",
- "Mode": "0755",
- "UID": "system",
- "GID": "system",
- "Optional": true
- }
- ]
-}
diff --git a/libprocessgroup/profiles/task_profiles_28.json b/libprocessgroup/profiles/task_profiles_28.json
deleted file mode 100644
index e7be548..0000000
--- a/libprocessgroup/profiles/task_profiles_28.json
+++ /dev/null
@@ -1,160 +0,0 @@
-{
- "Attributes": [
- {
- "Name": "STuneBoost",
- "Controller": "schedtune",
- "File": "schedtune.boost"
- },
- {
- "Name": "STunePreferIdle",
- "Controller": "schedtune",
- "File": "schedtune.prefer_idle"
- }
- ],
-
- "Profiles": [
- {
- "Name": "HighEnergySaving",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "background"
- }
- }
- ]
- },
- {
- "Name": "NormalPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": ""
- }
- }
- ]
- },
- {
- "Name": "ServicePerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "background"
- }
- }
- ]
- },
- {
- "Name": "HighPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "foreground"
- }
- }
- ]
- },
- {
- "Name": "MaxPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "top-app"
- }
- }
- ]
- },
- {
- "Name": "RealtimePerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "rt"
- }
- }
- ]
- },
- {
- "Name": "CameraServicePerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "camera-daemon"
- }
- }
- ]
- },
- {
- "Name": "NNApiHALPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "nnapi-hal"
- }
- }
- ]
- },
- {
- "Name": "Dex2oatPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "background"
- }
- }
- ]
- },
- {
- "Name": "CpuPolicySpread",
- "Actions": [
- {
- "Name": "SetAttribute",
- "Params":
- {
- "Name": "STunePreferIdle",
- "Value": "1"
- }
- }
- ]
- },
- {
- "Name": "CpuPolicyPack",
- "Actions": [
- {
- "Name": "SetAttribute",
- "Params":
- {
- "Name": "STunePreferIdle",
- "Value": "0"
- }
- }
- ]
- }
- ]
-}
diff --git a/libprocessgroup/profiles/task_profiles_29.json b/libprocessgroup/profiles/task_profiles_29.json
deleted file mode 100644
index 6174c8d..0000000
--- a/libprocessgroup/profiles/task_profiles_29.json
+++ /dev/null
@@ -1,160 +0,0 @@
-{
- "Attributes": [
- {
- "Name": "STuneBoost",
- "Controller": "schedtune",
- "File": "schedtune.boost"
- },
- {
- "Name": "STunePreferIdle",
- "Controller": "schedtune",
- "File": "schedtune.prefer_idle"
- }
- ],
-
- "Profiles": [
- {
- "Name": "HighEnergySaving",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "background"
- }
- }
- ]
- },
- {
- "Name": "NormalPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": ""
- }
- }
- ]
- },
- {
- "Name": "HighPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "foreground"
- }
- }
- ]
- },
- {
- "Name": "ServicePerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "background"
- }
- }
- ]
- },
- {
- "Name": "MaxPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "top-app"
- }
- }
- ]
- },
- {
- "Name": "RealtimePerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "rt"
- }
- }
- ]
- },
- {
- "Name": "CameraServicePerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "camera-daemon"
- }
- }
- ]
- },
- {
- "Name": "NNApiHALPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "nnapi-hal"
- }
- }
- ]
- },
- {
- "Name": "Dex2oatPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "background"
- }
- }
- ]
- },
- {
- "Name": "CpuPolicySpread",
- "Actions": [
- {
- "Name": "SetAttribute",
- "Params":
- {
- "Name": "STunePreferIdle",
- "Value": "1"
- }
- }
- ]
- },
- {
- "Name": "CpuPolicyPack",
- "Actions": [
- {
- "Name": "SetAttribute",
- "Params":
- {
- "Name": "STunePreferIdle",
- "Value": "0"
- }
- }
- ]
- }
- ]
-}
diff --git a/libprocessgroup/profiles/task_profiles_30.json b/libprocessgroup/profiles/task_profiles_30.json
deleted file mode 100644
index e7be548..0000000
--- a/libprocessgroup/profiles/task_profiles_30.json
+++ /dev/null
@@ -1,160 +0,0 @@
-{
- "Attributes": [
- {
- "Name": "STuneBoost",
- "Controller": "schedtune",
- "File": "schedtune.boost"
- },
- {
- "Name": "STunePreferIdle",
- "Controller": "schedtune",
- "File": "schedtune.prefer_idle"
- }
- ],
-
- "Profiles": [
- {
- "Name": "HighEnergySaving",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "background"
- }
- }
- ]
- },
- {
- "Name": "NormalPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": ""
- }
- }
- ]
- },
- {
- "Name": "ServicePerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "background"
- }
- }
- ]
- },
- {
- "Name": "HighPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "foreground"
- }
- }
- ]
- },
- {
- "Name": "MaxPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "top-app"
- }
- }
- ]
- },
- {
- "Name": "RealtimePerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "rt"
- }
- }
- ]
- },
- {
- "Name": "CameraServicePerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "camera-daemon"
- }
- }
- ]
- },
- {
- "Name": "NNApiHALPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "nnapi-hal"
- }
- }
- ]
- },
- {
- "Name": "Dex2oatPerformance",
- "Actions": [
- {
- "Name": "JoinCgroup",
- "Params":
- {
- "Controller": "schedtune",
- "Path": "background"
- }
- }
- ]
- },
- {
- "Name": "CpuPolicySpread",
- "Actions": [
- {
- "Name": "SetAttribute",
- "Params":
- {
- "Name": "STunePreferIdle",
- "Value": "1"
- }
- }
- ]
- },
- {
- "Name": "CpuPolicyPack",
- "Actions": [
- {
- "Name": "SetAttribute",
- "Params":
- {
- "Name": "STunePreferIdle",
- "Value": "0"
- }
- }
- ]
- }
- ]
-}
diff --git a/libprocessgroup/sched_policy.cpp b/libprocessgroup/sched_policy.cpp
index 042bcd2..5a53c35 100644
--- a/libprocessgroup/sched_policy.cpp
+++ b/libprocessgroup/sched_policy.cpp
@@ -148,20 +148,10 @@
return enabled;
}
-static bool schedtune_enabled() {
- return (CgroupMap::GetInstance().FindController("schedtune").IsUsable());
-}
-
static bool cpuctl_enabled() {
return (CgroupMap::GetInstance().FindController("cpu").IsUsable());
}
-bool schedboost_enabled() {
- static bool enabled = schedtune_enabled() || cpuctl_enabled();
-
- return enabled;
-}
-
static int getCGroupSubsys(pid_t tid, const char* subsys, std::string& subgroup) {
auto controller = CgroupMap::GetInstance().FindController(subsys);
@@ -201,9 +191,8 @@
}
std::string group;
- if (schedboost_enabled()) {
- if ((getCGroupSubsys(tid, "schedtune", group) < 0) &&
- (getCGroupSubsys(tid, "cpu", group) < 0)) {
+ if (cpuctl_enabled()) {
+ if (getCGroupSubsys(tid, "cpu", group) < 0) {
LOG(ERROR) << "Failed to find cpu cgroup for tid " << tid;
return -1;
}