Commit f58b80be authored by Joanne Hugé's avatar Joanne Hugé

playbook/ors: disable hyperthreading

parent ec586de2
#!/bin/bash
CONF="/etc/default/grub"
BAK="/tmp/default.grub"
N_CORE="$(($(lscpu | sed -n 's/^Core.*: *\([0-9]*\)/\1/gp') * $(lscpu | sed -n 's/^Socket.*: *\([0-9]*\)/\1/gp')))"
cp $CONF $BAK;
if ! grep -q idle=halt /proc/cmdline; then
if ! (grep -q idle=halt /proc/cmdline && grep -q "maxcpus=$N_CORE" /proc/cmdline); then
sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT.*\)idle=[a-z]* *\(.*\)/\1\2/g' $CONF;
sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT.*\)"/\1 idle=halt"/g' $CONF;
sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT.*\)maxcpus=[0-9]* *\(.*\)/\1\2/g' $CONF;
sed -i 's/^\(GRUB_CMDLINE_LINUX_DEFAULT.*\)"/\1 maxcpus='"$N_CORE"'"/g' $CONF;
if ! update-grub; then
cp $BAK $CONF;
update-grub;
......
2f6f68fd28b5bae04559ee19b2ecf926b4dbe929d13200a214d1287ec2cd3d32 -
fc085ff3a6ec4b99b7baff843ace3c10d82bbdd70297ad86a45a31f24fa3fc2b -
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment