aboutsummaryrefslogtreecommitdiff
path: root/playbooks/roles/tcwg-tk1-cpucore/files/rc.local_llvm-tk1-02
blob: 58191717cb2990fd37b75e2a6a86419be59becec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.

rm -f /tmp/rc_local.log
exec 1>/tmp/rc_local.log 2>&1
set -x

# Bring all CPUs online
echo 0 > /sys/devices/system/cpu/cpuquiet/tegra_cpuquiet/enable
for cpu in /sys/devices/system/cpu/cpu[0-3]; do
  if [ x"$(cat $cpu/online)" = x"0" ]; then
    echo 1 > $cpu/online
  fi
done

# Make sure docker containers are configured to use all CPUs.
for cpuset in $(find /sys/fs/cgroup/cpuset/ -name cpuset.cpus); do
    echo 0-3 > $cpuset
done

# We fix CPU frequency to 90% of the max.
cpupower -c 0,1,2,3 frequency-set --governor performance --min 2116500 --max 2116500

# Allow perf profiling
sysctl kernel.kptr_restrict=0
sysctl kernel.perf_event_mlock_kb=1024
sysctl kernel.perf_event_paranoid=0

exit 0