3

Any ideas on how I can configure LXC/cgroups, to allow the use of SCHED_RR for applications in a container?

On the internet I have seen mention of unmounting the cpu-cgroup, I have tried that, manually (running umount on the cpu cgroup) that did not seem to help.

Any ideas of how I persistently unmount a cgroup? On Fedora 20.

Is unmounting, the cpu cgroup, the correct method for allowing container applications to use the SCHED_RR?

Thanks

2 Answers 2

1

I believe in addition to CAP_SYS_NICE, you'll also need CAP_SYS_ADMIN. I can't say for sure but the kernel has a check for ioprio() that requires CAP_SYS_ADMIN && CAP_SYS_NICE for a "real-time" priority like SCHED_RR.

See http://linux.die.net/man/2/ioprio_set

(Required permissions to set I/O priorities)

I ran into the same problem with any sched_setsched() calls returning a EPERM when I try to change scheduling priority within a container. I'm also getting EPERM error when I try the same change from the host to a process in the container.

EDIT: Actually, I'm wrong about this. I figure out how to get SCHED_RR to work for my setup. The call to sched_setscheduler() was erroring with EPERM because I hadn't set a real time budget in the cgroups folder.

Control Group policy does not allow for a real-time scheduling policy to be set without allocating a run-time budget, which is not set by the provided configuration.

https://www.novell.com/support/kb/doc.php?id=7012851

0

Remember that typically LXC containers drop capabilities on startup. You need to, at least, allow CAP_SYS_NICE in the container. This capability allows for calling sched_setscheduler() which is the call you need to set SCHED_RR.

An example for reference LXC configuration:

lxc.cap.keep = sys_nice

And of course your applications must also have CAP_SYS_NICE (or be run as root, in which case they already will).

2
  • Thanks, It will be a few days before I can check it out. I appreciate the help.
    – Henk
    Sep 23, 2014 at 13:27
  • How can this be added for an existing container? Nov 15, 2021 at 13:47

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .