[systemd-devel] Limiting resources

Cristian Patrascu Cristian.Patrascu at windriver.com
Tue Feb 22 02:33:17 PST 2011


Hi!

I have some questions regarding the options in a .service that can limit 
the resources of an application specified in ExecStart:
1. For memory resource I know there is the "LimitAS" option, but what 
about limiting the CPU, is there any option? For CPU limiting I'm 
interested in specifying the maximum percentage of CPU used or maybe the 
maximum time portion - microseconds or nanoseconds of CPU time (either 
way is good). The goal is not to kill the process, but to limit it at 
maximum X% cpu.
2. If there is such an option, is there a way to read the specified cpu 
limit from the control group hierarchy?
3. Let's say I set "LimitAS", is there a way to read the specified 
memory limit from the control group hierarcy?
4. How can I set limits in the control group specified in a .service file?
     Ex.:
     - in the following control group hierarchy: 
"[...]/cgroup/memory/some_subgroup/" there is a file 
"memory.limit_in_bytes" that contains the maximum memory limit of 
processes running in this subgroup. When processes reach that maximum 
amount of memory, they are killed. So can I set the 
"memory.limit_in_bytes" from a .service configuration file?


Thanks in advance,
Cristian Patrascu
Wind River


More information about the systemd-devel mailing list