SUSE Support

Here When You Need Us

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 1 (SLES 12 SP1)
SUSE Linux Enterprise Server 12 Service Pack 2 (SLES 12 SP2)

Situation

Systemd overwrites libcgroup settings from /etc/cgconfig.conf.

Resolution

The libcgroup resource control configuration file is in /etc/cgconfig.conf, however libcgroup is obsolete and it may conflict with systemd's own cgroup handling. The settings can be moved from /etc/cgconfig.conf to systemd unit configuration files.

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:

  group cpu-grp {
       cpu {
        cpu.cfs_quota_us=40000;
        cpu.cfs_period_us=100000;
     }
 }

the new or editied unit file /etc/systemd/system/example.service to start a program /opt/bin/quota40-app with quotas might look like this:

[Unit]
Description=Starting quota40-app with a CPU quota of 40%

[Service]
Type=simple
ExecStart=/opt/bin/quota40-app
CPUQuota=40%

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

Resource control specification is different between systemd and libcgroup, and there can be only one of them interacting with cgroup controllers.

Additional Information

The man page systemd.resource-control provides documentation for the various possible resource control settings in systemd to help transitioning from libcgroup.

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

< Back to Support Search

For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com

tick icon

SUSE Support Forums

Get your questions answered by experienced Sys Ops or interact with other SUSE community experts.

tick icon

Support Resources

Learn how to get the most from the technical support you receive with your SUSE Subscription, Premium Support, Academic Program, or Partner Program.

tick icon

Open an Incident

Open an incident with SUSE Technical Support, manage your subscriptions, download patches, or manage user access.