On Mon, Jul 17, 2017 at 4:14 AM, Lennart Poettering <lenn...@poettering.net>
wrote:

> And I'd probably turn this into a proper shell script, that
> dynamically reads the path from /proc/self/cgroup and then propagates
> things up properly.
>

Lennart,

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:

#!/bin/bash

desired_rt_runtime_us=$1
mygroup=${2:-$(awk -F: '$2 == "cpuacct,cpu" {print $3}' /proc/self/cgroup)}

[[ $desired_rt_runtime_us -gt 0 ]] || exit
[[ $mygroup ]] || exit
[[ $mygroup = / ]] && exit

echo "${0##*/}: setting cpu.rt_runtime_us for $mygroup" >&2

cgpath=
IFS=/ read -ra cgroups <<< "${mygroup:1}"
for cg in "${cgroups[@]}"; do
cgpath="${cgpath}/${cg}"
echo "${0##*/}: $desired_rt_runtime_us ->
/sys/fs/cgroup/cpu,cpuacct${cgpath}" >&2
echo "$desired_rt_runtime_us" >
/sys/fs/cgroup/cpu,cpuacct${cgpath}/cpu.rt_runtime_us
done

-- 
Lars Kellogg-Stedman <l...@redhat.com>
_______________________________________________
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Reply via email to