systemd memory limit user instance not working
Clash Royale CLAN TAG#URR8PPP
up vote
2
down vote
favorite
I'm using Arch Linux and systemd version is 239. I booted system with systemd.unified_cgroup_hierarchy=1 kernel parameter.
I made two unit files, limit.slice and malloc.service.
limit.slice is
[Unit]
Description=limit memory slice.
[Slice]
MemoryAccounting=yes
MemoryMax=100M
and malloc.service is
[Unit]
Description=memory consuming process
[Service]
ExecStart=/home/example/malloc_program
Slice=limit.slice
malloc_program is just keep calls malloc() to consume memory.
I put these files to /home/example/.config/systemd/user/ and run systemctl --user start malloc.service
.
Service's CGroup is under limit.slice
as expected.
CGroup: /user.slice/user-1000.slice/user@1000.service/limit.slice/malloc.service
But, the process keeps running even when the used memory was over 100 MB.
I can't understand why memory limitation is not working in user instance...
systemd cgroups
add a comment |Â
up vote
2
down vote
favorite
I'm using Arch Linux and systemd version is 239. I booted system with systemd.unified_cgroup_hierarchy=1 kernel parameter.
I made two unit files, limit.slice and malloc.service.
limit.slice is
[Unit]
Description=limit memory slice.
[Slice]
MemoryAccounting=yes
MemoryMax=100M
and malloc.service is
[Unit]
Description=memory consuming process
[Service]
ExecStart=/home/example/malloc_program
Slice=limit.slice
malloc_program is just keep calls malloc() to consume memory.
I put these files to /home/example/.config/systemd/user/ and run systemctl --user start malloc.service
.
Service's CGroup is under limit.slice
as expected.
CGroup: /user.slice/user-1000.slice/user@1000.service/limit.slice/malloc.service
But, the process keeps running even when the used memory was over 100 MB.
I can't understand why memory limitation is not working in user instance...
systemd cgroups
"malloc_program is just keep calls malloc() to consume memory" -> That's usually not enough, you usually need to "touch" the pages for Linux to actually allocate them for you. If you want a system to test using memory, consider usingmemhog
which is typically shipped with the "numactl" package.
â Filipe Brandenburger
Aug 20 at 20:48
Actually, I implemented that too. Sorry for lack of explenation.
â R00T3D
Aug 21 at 0:46
add a comment |Â
up vote
2
down vote
favorite
up vote
2
down vote
favorite
I'm using Arch Linux and systemd version is 239. I booted system with systemd.unified_cgroup_hierarchy=1 kernel parameter.
I made two unit files, limit.slice and malloc.service.
limit.slice is
[Unit]
Description=limit memory slice.
[Slice]
MemoryAccounting=yes
MemoryMax=100M
and malloc.service is
[Unit]
Description=memory consuming process
[Service]
ExecStart=/home/example/malloc_program
Slice=limit.slice
malloc_program is just keep calls malloc() to consume memory.
I put these files to /home/example/.config/systemd/user/ and run systemctl --user start malloc.service
.
Service's CGroup is under limit.slice
as expected.
CGroup: /user.slice/user-1000.slice/user@1000.service/limit.slice/malloc.service
But, the process keeps running even when the used memory was over 100 MB.
I can't understand why memory limitation is not working in user instance...
systemd cgroups
I'm using Arch Linux and systemd version is 239. I booted system with systemd.unified_cgroup_hierarchy=1 kernel parameter.
I made two unit files, limit.slice and malloc.service.
limit.slice is
[Unit]
Description=limit memory slice.
[Slice]
MemoryAccounting=yes
MemoryMax=100M
and malloc.service is
[Unit]
Description=memory consuming process
[Service]
ExecStart=/home/example/malloc_program
Slice=limit.slice
malloc_program is just keep calls malloc() to consume memory.
I put these files to /home/example/.config/systemd/user/ and run systemctl --user start malloc.service
.
Service's CGroup is under limit.slice
as expected.
CGroup: /user.slice/user-1000.slice/user@1000.service/limit.slice/malloc.service
But, the process keeps running even when the used memory was over 100 MB.
I can't understand why memory limitation is not working in user instance...
systemd cgroups
systemd cgroups
edited Aug 19 at 14:24
asked Aug 19 at 9:27
R00T3D
112
112
"malloc_program is just keep calls malloc() to consume memory" -> That's usually not enough, you usually need to "touch" the pages for Linux to actually allocate them for you. If you want a system to test using memory, consider usingmemhog
which is typically shipped with the "numactl" package.
â Filipe Brandenburger
Aug 20 at 20:48
Actually, I implemented that too. Sorry for lack of explenation.
â R00T3D
Aug 21 at 0:46
add a comment |Â
"malloc_program is just keep calls malloc() to consume memory" -> That's usually not enough, you usually need to "touch" the pages for Linux to actually allocate them for you. If you want a system to test using memory, consider usingmemhog
which is typically shipped with the "numactl" package.
â Filipe Brandenburger
Aug 20 at 20:48
Actually, I implemented that too. Sorry for lack of explenation.
â R00T3D
Aug 21 at 0:46
"malloc_program is just keep calls malloc() to consume memory" -> That's usually not enough, you usually need to "touch" the pages for Linux to actually allocate them for you. If you want a system to test using memory, consider using
memhog
which is typically shipped with the "numactl" package.â Filipe Brandenburger
Aug 20 at 20:48
"malloc_program is just keep calls malloc() to consume memory" -> That's usually not enough, you usually need to "touch" the pages for Linux to actually allocate them for you. If you want a system to test using memory, consider using
memhog
which is typically shipped with the "numactl" package.â Filipe Brandenburger
Aug 20 at 20:48
Actually, I implemented that too. Sorry for lack of explenation.
â R00T3D
Aug 21 at 0:46
Actually, I implemented that too. Sorry for lack of explenation.
â R00T3D
Aug 21 at 0:46
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
0
down vote
Try to set for malloc service at .slice file:
[Slice]
MemoryAccounting=true
MemoryLimit=100M
MemoryMax=100M
MemoryHigh=50M
It didn't work... Maybe it is a bug of systemd? github.com/systemd/systemd/issues/9512
â R00T3D
Aug 20 at 0:30
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
Try to set for malloc service at .slice file:
[Slice]
MemoryAccounting=true
MemoryLimit=100M
MemoryMax=100M
MemoryHigh=50M
It didn't work... Maybe it is a bug of systemd? github.com/systemd/systemd/issues/9512
â R00T3D
Aug 20 at 0:30
add a comment |Â
up vote
0
down vote
Try to set for malloc service at .slice file:
[Slice]
MemoryAccounting=true
MemoryLimit=100M
MemoryMax=100M
MemoryHigh=50M
It didn't work... Maybe it is a bug of systemd? github.com/systemd/systemd/issues/9512
â R00T3D
Aug 20 at 0:30
add a comment |Â
up vote
0
down vote
up vote
0
down vote
Try to set for malloc service at .slice file:
[Slice]
MemoryAccounting=true
MemoryLimit=100M
MemoryMax=100M
MemoryHigh=50M
Try to set for malloc service at .slice file:
[Slice]
MemoryAccounting=true
MemoryLimit=100M
MemoryMax=100M
MemoryHigh=50M
answered Aug 19 at 16:21
Adminisrator
314
314
It didn't work... Maybe it is a bug of systemd? github.com/systemd/systemd/issues/9512
â R00T3D
Aug 20 at 0:30
add a comment |Â
It didn't work... Maybe it is a bug of systemd? github.com/systemd/systemd/issues/9512
â R00T3D
Aug 20 at 0:30
It didn't work... Maybe it is a bug of systemd? github.com/systemd/systemd/issues/9512
â R00T3D
Aug 20 at 0:30
It didn't work... Maybe it is a bug of systemd? github.com/systemd/systemd/issues/9512
â R00T3D
Aug 20 at 0:30
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f463460%2fsystemd-memory-limit-user-instance-not-working%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
"malloc_program is just keep calls malloc() to consume memory" -> That's usually not enough, you usually need to "touch" the pages for Linux to actually allocate them for you. If you want a system to test using memory, consider using
memhog
which is typically shipped with the "numactl" package.â Filipe Brandenburger
Aug 20 at 20:48
Actually, I implemented that too. Sorry for lack of explenation.
â R00T3D
Aug 21 at 0:46