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
1ea59ad2
Commit
1ea59ad2
authored
Oct 25, 2013
by
Serge Hallyn
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cgroup: set memory.use_hierarchy
But don't fail the container start if that fails. Signed-off-by:
Serge Hallyn
<
serge.hallyn@ubuntu.com
>
Acked-by:
Stéphane Graber
<
stgraber@ubuntu.com
>
parent
1563f8ef
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
4 deletions
+18
-4
cgroup.c
src/lxc/cgroup.c
+18
-4
No files found.
src/lxc/cgroup.c
View file @
1ea59ad2
...
@@ -81,7 +81,7 @@ static bool cgroup_devices_has_allow_or_deny(struct lxc_handler *h, char *v, boo
...
@@ -81,7 +81,7 @@ static bool cgroup_devices_has_allow_or_deny(struct lxc_handler *h, char *v, boo
static
int
do_setup_cgroup
(
struct
lxc_handler
*
h
,
struct
lxc_list
*
cgroup_settings
,
bool
do_devices
);
static
int
do_setup_cgroup
(
struct
lxc_handler
*
h
,
struct
lxc_list
*
cgroup_settings
,
bool
do_devices
);
static
int
cgroup_recursive_task_count
(
const
char
*
cgroup_path
);
static
int
cgroup_recursive_task_count
(
const
char
*
cgroup_path
);
static
int
count_lines
(
const
char
*
fn
);
static
int
count_lines
(
const
char
*
fn
);
static
int
handle_c
lone_children
(
struct
cgroup_mount_point
*
mp
,
char
*
cgroup_path
);
static
int
handle_c
group_settings
(
struct
cgroup_mount_point
*
mp
,
char
*
cgroup_path
);
struct
cgroup_meta_data
*
lxc_cgroup_load_meta
()
struct
cgroup_meta_data
*
lxc_cgroup_load_meta
()
{
{
...
@@ -718,7 +718,7 @@ extern struct cgroup_process_info *lxc_cgroup_create(const char *name, const cha
...
@@ -718,7 +718,7 @@ extern struct cgroup_process_info *lxc_cgroup_create(const char *name, const cha
if
(
lxc_string_in_array
(
"ns"
,
(
const
char
**
)
h
->
subsystems
))
if
(
lxc_string_in_array
(
"ns"
,
(
const
char
**
)
h
->
subsystems
))
continue
;
continue
;
if
(
handle_c
lone_children
(
mp
,
info_ptr
->
cgroup_path
)
<
0
)
{
if
(
handle_c
group_settings
(
mp
,
info_ptr
->
cgroup_path
)
<
0
)
{
ERROR
(
"Could not set clone_children to 1 for cpuset hierarchy in parent cgroup."
);
ERROR
(
"Could not set clone_children to 1 for cpuset hierarchy in parent cgroup."
);
goto
out_initial_error
;
goto
out_initial_error
;
}
}
...
@@ -838,7 +838,7 @@ extern struct cgroup_process_info *lxc_cgroup_create(const char *name, const cha
...
@@ -838,7 +838,7 @@ extern struct cgroup_process_info *lxc_cgroup_create(const char *name, const cha
/* if we didn't create the cgroup, then we have to make sure that
/* if we didn't create the cgroup, then we have to make sure that
* further cgroups will be created properly
* further cgroups will be created properly
*/
*/
if
(
handle_c
lone_children
(
mp
,
info_ptr
->
cgroup_path
)
<
0
)
{
if
(
handle_c
group_settings
(
mp
,
info_ptr
->
cgroup_path
)
<
0
)
{
ERROR
(
"Could not set clone_children to 1 for cpuset hierarchy in pre-existing cgroup."
);
ERROR
(
"Could not set clone_children to 1 for cpuset hierarchy in pre-existing cgroup."
);
goto
cleanup_from_error
;
goto
cleanup_from_error
;
}
}
...
@@ -1939,9 +1939,23 @@ int count_lines(const char *fn)
...
@@ -1939,9 +1939,23 @@ int count_lines(const char *fn)
return
n
;
return
n
;
}
}
int
handle_c
lone_children
(
struct
cgroup_mount_point
*
mp
,
char
*
cgroup_path
)
int
handle_c
group_settings
(
struct
cgroup_mount_point
*
mp
,
char
*
cgroup_path
)
{
{
int
r
,
saved_errno
=
0
;
int
r
,
saved_errno
=
0
;
/* If this is the memory cgroup, we want to enforce hierarchy.
* But don't fail if for some reason we can't.
*/
if
(
lxc_string_in_array
(
"memory"
,
(
const
char
**
)
mp
->
hierarchy
->
subsystems
))
{
char
*
cc_path
=
cgroup_to_absolute_path
(
mp
,
cgroup_path
,
"/memory.use_hierarchy"
);
if
(
cc_path
)
{
r
=
lxc_write_to_file
(
cc_path
,
"1"
,
1
,
false
);
if
(
r
<
0
)
SYSERROR
(
"failed to set memory.use_hiararchy to 1; continuing"
);
free
(
cc_path
);
}
}
/* if this is a cpuset hierarchy, we have to set cgroup.clone_children in
/* if this is a cpuset hierarchy, we have to set cgroup.clone_children in
* the base cgroup, otherwise containers will start with an empty cpuset.mems
* the base cgroup, otherwise containers will start with an empty cpuset.mems
* and cpuset.cpus and then
* and cpuset.cpus and then
...
...
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