[system/core] CGROUP : Fix duplicate setting the same policy
Get current schedule policy first before setting. Signed-off-by: Firefly <service@t-firefly.com>
This commit is contained in:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user