<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Jul 17, 2017 at 4:14 AM, Lennart Poettering <span dir="ltr"><<a href="mailto:lennart@poettering.net" target="_blank">lennart@poettering.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div id="gmail-:1ud" class="gmail-a3s gmail-aXjCH gmail-m15d4fa3b1b164c04">And I'd probably turn this into a proper shell script, that<br>
dynamically reads the path from /proc/self/cgroup and then propagates things up properly.<br></div></blockquote></div><div class="gmail_extra"><br></div>Lennart,</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks for the information.  In case anyone comes across this thread and wonders "what might that shell script look like?", the following seems to work:</div><div class="gmail_extra"><br></div><div class="gmail_extra"><div class="gmail_extra">#!/bin/bash</div><div class="gmail_extra"><br></div><div class="gmail_extra">desired_rt_runtime_us=$1</div><div class="gmail_extra">mygroup=${2:-$(awk -F: '$2 == "cpuacct,cpu" {print $3}' /proc/self/cgroup)}</div><div class="gmail_extra"><br></div><div class="gmail_extra">[[ $desired_rt_runtime_us -gt 0 ]] || exit</div><div class="gmail_extra">[[ $mygroup ]] || exit</div><div class="gmail_extra">[[ $mygroup = / ]] && exit</div><div class="gmail_extra"><br></div><div class="gmail_extra">echo "${0##*/}: setting cpu.rt_runtime_us for $mygroup" >&2</div><div class="gmail_extra"><br></div><div class="gmail_extra">cgpath=</div><div class="gmail_extra">IFS=/ read -ra cgroups <<< "${mygroup:1}"</div><div class="gmail_extra">for cg in "${cgroups[@]}"; do</div><div class="gmail_extra"><span style="white-space:pre">   </span>cgpath="${cgpath}/${cg}"<br></div><div class="gmail_extra"><span style="white-space:pre">    </span>echo "${0##*/}: $desired_rt_runtime_us -> /sys/fs/cgroup/cpu,cpuacct${cgpath}" >&2</div><div class="gmail_extra"><span style="white-space:pre">  </span>echo "$desired_rt_runtime_us" > /sys/fs/cgroup/cpu,cpuacct${cgpath}/cpu.rt_runtime_us</div><div class="gmail_extra">done</div><div><br></div></div><div class="gmail_extra"><div>-- <br></div><div class="gmail_signature"><div dir="ltr">Lars Kellogg-Stedman <<a href="mailto:lars@redhat.com" target="_blank">lars@redhat.com</a>><div><br></div></div></div>
</div></div>