Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce real-time priority to 98 #3

Merged
merged 2 commits into from
Oct 31, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
reduce prior group by one
  • Loading branch information
simutisernestas committed Oct 31, 2022
commit 6f2819fda7ef51e63a847475725a13a0e4b09e81
6 changes: 2 additions & 4 deletions ReadMe.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,13 @@ After having patched your system and restarted it, booting into the freshly inst
cap_add:
- SYS_NICE
ulimits:
rtprio: 99
rtprio: 98
rttime: -1 # corresponds to 'unlimited'
memlock: 8428281856
network_mode: host
```

Then **any process from inside the Docker can set real-time priorities `rtprio`** (e.g. by calling [`::pthread_setschedparam`](https://man7.org/linux/man-pages/man3/pthread_getschedparam.3.html) from inside the C/C++ code or by using [`chrt`](https://askubuntu.com/a/51285) from the command line).


Then **any process from inside the Docker can set real-time priorities `rtprio`** (e.g. by calling [`::pthread_setschedparam`](https://man7.org/linux/man-pages/man3/pthread_getschedparam.3.html) from inside the C/C++ code or by using [`chrt`](https://askubuntu.com/a/51285) from the command line). Note: [do NOT](https://github.com/ros2-realtime-demo/pendulum/blob/rolling/docs/real_time_linux.md#setting-permissions-for-the-scheduler) set rtprio to 99.

## 2. Example

Expand Down
2 changes: 1 addition & 1 deletion doc/docker_realtime/ControlGroups.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Similarly in a Docker-Compose file this can be achieved with (see the official D
privileged: true
cpu_rt_runtime: 950000
ulimits:
rtprio: 99
rtprio: 98
```

The real-time runtime `cpu.rt_runtime_us` allocated for each group can be inspected in `/sys/fs/cgroup/cpu,cpuacct`. In case you have already allocated a large portion of real-time runtime to another cgroup this might result in the error message `failed to write 95000 to cpu.rt_runtime_us: write /sys/fs/cgroup/cpu,cpuacct/system.slice/.../cpu.rt_runtime_us: invalid argument` or similar (as discussed [here](https://stackoverflow.com/questions/28493333/error-writing-to-cgroup-parameter-cpu-rt-runtime-us) and [here](https://github.com/moby/moby/issues/31411)). For more details on control groups in Linux see [here](https://www.kernel.org/doc/html/latest/scheduler/sched-rt-group.html) and [here](https://www.kernel.org/doc/html/latest/admin-guide/cgroup-v1/cgroups.html). Now any process that is launched should be assigned to the corresponding real-time control group.
2 changes: 1 addition & 1 deletion docker/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
cap_add:
- SYS_NICE
ulimits:
rtprio: 99
rtprio: 98
rttime: -1
memlock: 8428281856
network_mode: host
Expand Down