snapuserd: Set taskprofile OtaProfiles

Since update-engine already has this profile set,
it is better to have similar profile for the daemon
so that threads don't run at high priority.

Additionally, lower the nice value for worker
threads.

No change in the OTA install time observed.

Bug: 237490659
Test: Full OTA on Pixel
Change-Id: I53ec8c647eb781965792683b04621e6fec5eb5f2
Signed-off-by: Akilesh Kailash <akailash@google.com>
This commit is contained in:
Akilesh Kailash 2022-09-26 22:42:19 -07:00
parent 751cdc9489
commit 2e780402e2
2 changed files with 6 additions and 0 deletions

View file

@ -4,6 +4,7 @@ service snapuserd /system/bin/snapuserd
disabled
user root
group root system
task_profiles OtaProfiles
seclabel u:r:snapuserd:s0
service snapuserd_proxy /system/bin/snapuserd -socket-handoff

View file

@ -253,6 +253,11 @@ bool Worker::Init() {
bool Worker::RunThread() {
SNAP_LOG(INFO) << "Processing snapshot I/O requests....";
if (setpriority(PRIO_PROCESS, gettid(), kNiceValueForMergeThreads)) {
SNAP_PLOG(ERROR) << "Failed to set priority for TID: " << gettid();
}
// Start serving IO
while (true) {
if (!ProcessIORequest()) {