#!/bin/sh
# Limit available cpus and speed in actdead  ($1 == LIMIT)
# Return full speed when actdead is over ($1 == FULL)

if [ "$1" == "LIMIT" ]; then
    ONLINE=0
    GOVERNOR="ondemand"
else
    ONLINE=1
    GOVERNOR="performance"
fi


# Stop/start other cpus except 0
for CPU_PATH in /sys/devices/system/cpu/cpu[1-9]; do 
    echo $ONLINE > $CPU_PATH/online
done
echo $GOVERNOR > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
