Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lxc
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
lxc
Commits
ca72ccb5
Unverified
Commit
ca72ccb5
authored
Feb 21, 2021
by
Christian Brauner
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroups: improve utility controller handling
Signed-off-by:
Christian Brauner
<
christian.brauner@ubuntu.com
>
parent
042f9e9c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
7 deletions
+23
-7
cgfsng.c
src/lxc/cgroups/cgfsng.c
+5
-5
cgroup.h
src/lxc/cgroups/cgroup.h
+18
-2
No files found.
src/lxc/cgroups/cgfsng.c
View file @
ca72ccb5
...
...
@@ -123,12 +123,12 @@ static struct hierarchy *get_hierarchy(struct cgroup_ops *ops, const char *contr
*/
if
(
pure_unified_layout
(
ops
))
{
if
(
strequal
(
controller
,
"devices"
))
{
if
(
ops
->
unified
->
bpf_device_controller
)
if
(
device_utility_controller
(
ops
->
unified
)
)
return
ops
->
unified
;
break
;
}
else
if
(
strequal
(
controller
,
"freezer"
))
{
if
(
ops
->
unified
->
freezer_controller
)
if
(
freezer_utility_controller
(
ops
->
unified
)
)
return
ops
->
unified
;
break
;
...
...
@@ -1402,7 +1402,7 @@ __cgfsng_ops static void cgfsng_payload_finalize(struct cgroup_ops *ops)
!
faccessat
(
ops
->
unified
->
dfd_con
,
"cgroup.freeze"
,
F_OK
,
AT_SYMLINK_NOFOLLOW
))
{
TRACE
(
"Unified hierarchy supports freezer"
);
ops
->
unified
->
freezer_controller
=
1
;
ops
->
unified
->
utilities
|=
FREEZER_CONTROLLER
;
}
}
...
...
@@ -2838,7 +2838,7 @@ __cgfsng_ops static bool cgfsng_devices_activate(struct cgroup_ops *ops, struct
conf
=
handler
->
conf
;
unified
=
ops
->
unified
;
if
(
!
unified
||
!
unified
->
bpf_device_controller
||
if
(
!
unified
||
!
device_utility_controller
(
unified
)
||
!
unified
->
path_con
||
lxc_list_empty
(
&
(
conf
->
bpf_devices
).
device_item
))
return
true
;
...
...
@@ -3222,7 +3222,7 @@ static int __initialize_cgroups(struct cgroup_ops *ops, bool relative,
ops
->
cgroup_layout
=
CGROUP_LAYOUT_HYBRID
;
}
else
{
if
(
bpf_devices_cgroup_supported
())
ops
->
unified
->
bpf_device_controller
=
1
;
ops
->
unified
->
utilities
|=
DEVICES_CONTROLLER
;
ops
->
cgroup_layout
=
CGROUP_LAYOUT_UNIFIED
;
}
}
...
...
src/lxc/cgroups/cgroup.h
View file @
ca72ccb5
...
...
@@ -38,6 +38,9 @@ typedef enum {
UNIFIED_HIERARCHY
=
CGROUP2_SUPER_MAGIC
,
}
cgroupfs_type_magic_t
;
#define DEVICES_CONTROLLER (1U << 0)
#define FREEZER_CONTROLLER (1U << 1)
/* A descriptor for a mounted hierarchy
*
* @controllers
...
...
@@ -104,13 +107,26 @@ struct hierarchy {
struct
/* unified hierarchy specific */
{
char
**
delegate
;
unsigned
int
bpf_device_controller
:
1
;
unsigned
int
freezer_controller
:
1
;
unsigned
int
utilities
;
};
char
**
controllers
;
};
static
inline
bool
device_utility_controller
(
const
struct
hierarchy
*
h
)
{
if
(
h
->
fs_type
==
UNIFIED_HIERARCHY
&&
(
h
->
utilities
&
DEVICES_CONTROLLER
))
return
true
;
return
false
;
}
static
inline
bool
freezer_utility_controller
(
const
struct
hierarchy
*
h
)
{
if
(
h
->
fs_type
==
UNIFIED_HIERARCHY
&&
(
h
->
utilities
&
FREEZER_CONTROLLER
))
return
true
;
return
false
;
}
struct
cgroup_ops
{
/* string constant */
const
char
*
driver
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment