systemd memory limit user instance not working

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite
2












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...










share|improve this question























  • "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














up vote
2
down vote

favorite
2












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...










share|improve this question























  • "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












up vote
2
down vote

favorite
2









up vote
2
down vote

favorite
2






2





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...










share|improve this question















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






share|improve this question















share|improve this question













share|improve this question




share|improve this question








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 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
















  • "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















"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










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





share|improve this answer




















  • It didn't work... Maybe it is a bug of systemd? github.com/systemd/systemd/issues/9512
    – R00T3D
    Aug 20 at 0:30










Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















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






























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





share|improve this answer




















  • It didn't work... Maybe it is a bug of systemd? github.com/systemd/systemd/issues/9512
    – R00T3D
    Aug 20 at 0:30














up vote
0
down vote













Try to set for malloc service at .slice file:



[Slice]
MemoryAccounting=true
MemoryLimit=100M
MemoryMax=100M
MemoryHigh=50M





share|improve this answer




















  • It didn't work... Maybe it is a bug of systemd? github.com/systemd/systemd/issues/9512
    – R00T3D
    Aug 20 at 0:30












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





share|improve this answer












Try to set for malloc service at .slice file:



[Slice]
MemoryAccounting=true
MemoryLimit=100M
MemoryMax=100M
MemoryHigh=50M






share|improve this answer












share|improve this answer



share|improve this answer










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
















  • 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

















 

draft saved


draft discarded















































 


draft saved


draft discarded














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













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay