diff --git a/system/core/libcutils/sched_policy.c b/system/core/libcutils/sched_policy.c index 493511e57f..c208f5a5ab 100644 --- a/system/core/libcutils/sched_policy.c +++ b/system/core/libcutils/sched_policy.c @@ -1,16 +1,16 @@ /* ** Copyright 2007, The Android Open Source Project ** -** Licensed under the Apache License, Version 2.0 (the "License"); -** you may not use this file except in compliance with the License. -** You may obtain a copy of the License at +** Licensed under the Apache License, Version 2.0 (the "License"); +** you may not use this file except in compliance with the License. +** You may obtain a copy of the License at ** -** http://www.apache.org/licenses/LICENSE-2.0 +** http://www.apache.org/licenses/LICENSE-2.0 ** -** Unless required by applicable law or agreed to in writing, software -** distributed under the License is distributed on an "AS IS" BASIS, -** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -** See the License for the specific language governing permissions and +** Unless required by applicable law or agreed to in writing, software +** distributed under the License is distributed on an "AS IS" BASIS, +** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +** See the License for the specific language governing permissions and ** limitations under the License. */ @@ -64,6 +64,12 @@ static int add_tid_to_cgroup(int tid, SchedPolicy policy) { int fd; + SchedPolicy tmp_policy; + get_sched_policy(tid,&tmp_policy); + if (tmp_policy == policy) { + return 0; + } + switch (policy) { case SP_BACKGROUND: fd = bg_cgroup_fd;