Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AndroidSystemCore
Manage
Activity
Members
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Analyze
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Werner Sembach
AndroidSystemCore
Commits
278ee6b9
Commit
278ee6b9
authored
Mar 29, 2017
by
Wei Wang
Committed by
android-build-team Robot
May 11, 2017
Browse files
Options
Downloads
Patches
Plain Diff
libcutils: remove schedgroup fds [DO NOT MERGE]
Change-Id: Ie2c576dca8097668edd4c4e4fe947e862bd0c6d9
parent
1d2adc7f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
libcutils/sched_policy.c
+3
-29
3 additions, 29 deletions
libcutils/sched_policy.c
with
3 additions
and
29 deletions
libcutils/sched_policy.c
+
3
−
29
View file @
278ee6b9
...
@@ -56,10 +56,6 @@ static pthread_once_t the_once = PTHREAD_ONCE_INIT;
...
@@ -56,10 +56,6 @@ static pthread_once_t the_once = PTHREAD_ONCE_INIT;
static
int
__sys_supports_schedgroups
=
-
1
;
static
int
__sys_supports_schedgroups
=
-
1
;
// File descriptors open to /dev/cpuctl/../tasks, setup by initialize, or -1 on error.
static
int
bg_cgroup_fd
=
-
1
;
static
int
fg_cgroup_fd
=
-
1
;
#ifdef USE_CPUSETS
#ifdef USE_CPUSETS
// File descriptors open to /dev/cpuset/../tasks, setup by initialize, or -1 on error
// File descriptors open to /dev/cpuset/../tasks, setup by initialize, or -1 on error
static
int
system_bg_cpuset_fd
=
-
1
;
static
int
system_bg_cpuset_fd
=
-
1
;
...
@@ -73,6 +69,7 @@ static int bg_schedboost_fd = -1;
...
@@ -73,6 +69,7 @@ static int bg_schedboost_fd = -1;
static
int
fg_schedboost_fd
=
-
1
;
static
int
fg_schedboost_fd
=
-
1
;
static
int
ta_schedboost_fd
=
-
1
;
static
int
ta_schedboost_fd
=
-
1
;
#if defined(USE_CPUSETS) || defined(USE_SCHEDBOOST)
/* Add tid to the scheduling group defined by the policy */
/* Add tid to the scheduling group defined by the policy */
static
int
add_tid_to_cgroup
(
int
tid
,
int
fd
)
static
int
add_tid_to_cgroup
(
int
tid
,
int
fd
)
{
{
...
@@ -107,30 +104,18 @@ static int add_tid_to_cgroup(int tid, int fd)
...
@@ -107,30 +104,18 @@ static int add_tid_to_cgroup(int tid, int fd)
return
0
;
return
0
;
}
}
#endif //defined(USE_CPUSETS) || defined(USE_SCHEDBOOST)
static
void
__initialize
(
void
)
{
static
void
__initialize
(
void
)
{
char
*
filename
;
if
(
!
access
(
"/dev/cpuctl/tasks"
,
F_OK
))
{
if
(
!
access
(
"/dev/cpuctl/tasks"
,
F_OK
))
{
__sys_supports_schedgroups
=
1
;
__sys_supports_schedgroups
=
1
;
filename
=
"/dev/cpuctl/tasks"
;
fg_cgroup_fd
=
open
(
filename
,
O_WRONLY
|
O_CLOEXEC
);
if
(
fg_cgroup_fd
<
0
)
{
SLOGE
(
"open of %s failed: %s
\n
"
,
filename
,
strerror
(
errno
));
}
filename
=
"/dev/cpuctl/bg_non_interactive/tasks"
;
bg_cgroup_fd
=
open
(
filename
,
O_WRONLY
|
O_CLOEXEC
);
if
(
bg_cgroup_fd
<
0
)
{
SLOGE
(
"open of %s failed: %s
\n
"
,
filename
,
strerror
(
errno
));
}
}
else
{
}
else
{
__sys_supports_schedgroups
=
0
;
__sys_supports_schedgroups
=
0
;
}
}
#ifdef USE_CPUSETS
#ifdef USE_CPUSETS
if
(
!
access
(
"/dev/cpuset/tasks"
,
F_OK
))
{
if
(
!
access
(
"/dev/cpuset/tasks"
,
F_OK
))
{
char
*
filename
;
filename
=
"/dev/cpuset/foreground/tasks"
;
filename
=
"/dev/cpuset/foreground/tasks"
;
fg_cpuset_fd
=
open
(
filename
,
O_WRONLY
|
O_CLOEXEC
);
fg_cpuset_fd
=
open
(
filename
,
O_WRONLY
|
O_CLOEXEC
);
filename
=
"/dev/cpuset/background/tasks"
;
filename
=
"/dev/cpuset/background/tasks"
;
...
@@ -380,35 +365,24 @@ int set_sched_policy(int tid, SchedPolicy policy)
...
@@ -380,35 +365,24 @@ int set_sched_policy(int tid, SchedPolicy policy)
#endif
#endif
if
(
__sys_supports_schedgroups
)
{
if
(
__sys_supports_schedgroups
)
{
int
fd
=
-
1
;
int
boost_fd
=
-
1
;
int
boost_fd
=
-
1
;
switch
(
policy
)
{
switch
(
policy
)
{
case
SP_BACKGROUND
:
case
SP_BACKGROUND
:
fd
=
bg_cgroup_fd
;
boost_fd
=
bg_schedboost_fd
;
boost_fd
=
bg_schedboost_fd
;
break
;
break
;
case
SP_FOREGROUND
:
case
SP_FOREGROUND
:
case
SP_AUDIO_APP
:
case
SP_AUDIO_APP
:
case
SP_AUDIO_SYS
:
case
SP_AUDIO_SYS
:
fd
=
fg_cgroup_fd
;
boost_fd
=
fg_schedboost_fd
;
boost_fd
=
fg_schedboost_fd
;
break
;
break
;
case
SP_TOP_APP
:
case
SP_TOP_APP
:
fd
=
fg_cgroup_fd
;
boost_fd
=
ta_schedboost_fd
;
boost_fd
=
ta_schedboost_fd
;
break
;
break
;
default:
default:
fd
=
-
1
;
boost_fd
=
-
1
;
boost_fd
=
-
1
;
break
;
break
;
}
}
if
(
fd
>
0
&&
add_tid_to_cgroup
(
tid
,
fd
)
!=
0
)
{
if
(
errno
!=
ESRCH
&&
errno
!=
ENOENT
)
return
-
errno
;
}
#ifdef USE_SCHEDBOOST
#ifdef USE_SCHEDBOOST
if
(
boost_fd
>
0
&&
add_tid_to_cgroup
(
tid
,
boost_fd
)
!=
0
)
{
if
(
boost_fd
>
0
&&
add_tid_to_cgroup
(
tid
,
boost_fd
)
!=
0
)
{
if
(
errno
!=
ESRCH
&&
errno
!=
ENOENT
)
if
(
errno
!=
ESRCH
&&
errno
!=
ENOENT
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment