From c39d60d11468fa11b0ec5b89b1c32a15c5e99368 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Wed, 29 Sep 2021 15:35:58 -0700 Subject: [PATCH 1/2] libutils: use system_background for low prio tasks in framework Bug: 201428466 Test: Build and boot check system_server's sched group Signed-off-by: Wei Wang Change-Id: Iffc47fdaf3ef8fba6eb01a12cf534a0393e3e91c --- libutils/Threads.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/libutils/Threads.cpp b/libutils/Threads.cpp index 540dcf49d..6e293c741 100644 --- a/libutils/Threads.cpp +++ b/libutils/Threads.cpp @@ -86,8 +86,10 @@ struct thread_data_t { // A new thread will be in its parent's sched group by default, // so we just need to handle the background case. + // currently set to system_background group which is different + // from background group for app. if (prio >= ANDROID_PRIORITY_BACKGROUND) { - SetTaskProfiles(0, {"SCHED_SP_BACKGROUND"}, true); + SetTaskProfiles(0, {"SCHED_SP_SYSTEM"}, true); } if (name) { @@ -313,7 +315,7 @@ int androidSetThreadPriority(pid_t tid, int pri) } if (pri >= ANDROID_PRIORITY_BACKGROUND) { - rc = SetTaskProfiles(tid, {"SCHED_SP_BACKGROUND"}, true) ? 0 : -1; + rc = SetTaskProfiles(tid, {"SCHED_SP_SYSTEM"}, true) ? 0 : -1; } else if (curr_pri >= ANDROID_PRIORITY_BACKGROUND) { SchedPolicy policy = SP_FOREGROUND; // Change to the sched policy group of the process. From c53d794ca8693630a03ecc54766ffa5ef03b168f Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Wed, 6 Oct 2021 15:05:07 -0700 Subject: [PATCH 2/2] task_profiles: add ServicePerformance to legacy device policy Since we are adding SCHED_SP_SYSTEM into framework, the policy is needed on older releases as well. Bug: 201428466 Test: Build Signed-off-by: Wei Wang Change-Id: I0784820bfec84fd8ef98f2feb2caee084d0a14a2 --- libprocessgroup/profiles/task_profiles_28.json | 13 +++++++++++++ libprocessgroup/profiles/task_profiles_29.json | 13 +++++++++++++ libprocessgroup/profiles/task_profiles_30.json | 13 +++++++++++++ 3 files changed, 39 insertions(+) diff --git a/libprocessgroup/profiles/task_profiles_28.json b/libprocessgroup/profiles/task_profiles_28.json index 9f8378590..56053e05a 100644 --- a/libprocessgroup/profiles/task_profiles_28.json +++ b/libprocessgroup/profiles/task_profiles_28.json @@ -39,6 +39,19 @@ } ] }, + { + "Name": "ServicePerformance", + "Actions": [ + { + "Name": "JoinCgroup", + "Params": + { + "Controller": "schedtune", + "Path": "background" + } + } + ] + }, { "Name": "HighPerformance", "Actions": [ diff --git a/libprocessgroup/profiles/task_profiles_29.json b/libprocessgroup/profiles/task_profiles_29.json index 9f8378590..52279b872 100644 --- a/libprocessgroup/profiles/task_profiles_29.json +++ b/libprocessgroup/profiles/task_profiles_29.json @@ -52,6 +52,19 @@ } ] }, + { + "Name": "ServicePerformance", + "Actions": [ + { + "Name": "JoinCgroup", + "Params": + { + "Controller": "schedtune", + "Path": "background" + } + } + ] + }, { "Name": "MaxPerformance", "Actions": [ diff --git a/libprocessgroup/profiles/task_profiles_30.json b/libprocessgroup/profiles/task_profiles_30.json index 9f8378590..56053e05a 100644 --- a/libprocessgroup/profiles/task_profiles_30.json +++ b/libprocessgroup/profiles/task_profiles_30.json @@ -39,6 +39,19 @@ } ] }, + { + "Name": "ServicePerformance", + "Actions": [ + { + "Name": "JoinCgroup", + "Params": + { + "Controller": "schedtune", + "Path": "background" + } + } + ] + }, { "Name": "HighPerformance", "Actions": [