How to migrate from libcgroup resource control setting to systemd unit setting.
This document (7018741) is provided subject to the disclaimer at the end of this document.
Environment
SUSE Linux Enterprise Server 12 Service Pack 2 (SLES 12 SP2)
Situation
Resolution
If the program that requires cgroup settings does not have a systemd unit file yet, creating a new one, for example /etc/systemd/system/example.service, that includes the appropriate resource control statements is necessary.
For example, if the settings in /etc/cgconfig.conf are looking like this:
The statement CPUQuota=40% sets the cpu quota to 40% (cfs_quota_us divided by cf_period_us multiplied by 100). The program can then be started by running systemctl start example.service.
If a program already has a service file, instead of editing the existing one drop-ins can be used for additional settings such as quotas. For drop-ins, a subdirectory for the service needs to be created, for example /etc/systemd/system/example.service.d/, and a files with names ending on .conf, for example 10-resource-control.conf can be created in it to set the additional directives for the service. Implementing above settings, /etc/systemd/system/example.service.d/10-resource-control.conf would look simply like this:
[Service]
CPUQuota=40%
Cause
Additional Information
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:7018741
- Creation Date: 26-Mar-2017
- Modified Date:03-Mar-2020
-
- SUSE Linux Enterprise Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com