diff options
author | jc_gargma <jc_gargma@iserlohn-fortress.net> | 2018-07-14 11:23:53 -0700 |
---|---|---|
committer | jc_gargma <jc_gargma@iserlohn-fortress.net> | 2018-07-14 11:23:53 -0700 |
commit | 77ba16f526b416e255fb7f4c230116920de3421e (patch) | |
tree | 18c27a8885680fe0dc3a16ef5d832d428fd773a5 | |
download | disable-hyperthreading-77ba16f526b416e255fb7f4c230116920de3421e.tar.xz |
Initial commit
-rw-r--r-- | PKGBUILD | 26 | ||||
-rw-r--r-- | disable-hyperthreading | 14 | ||||
-rw-r--r-- | disable-hyperthreading.install | 13 |
3 files changed, 53 insertions, 0 deletions
diff --git a/PKGBUILD b/PKGBUILD new file mode 100644 index 0000000..c323dbc --- /dev/null +++ b/PKGBUILD @@ -0,0 +1,26 @@ +# Maintainer: artoo <artoo@artixlinux.org> + +_url="https://raw.githubusercontent.com/gentoo/gentoo/master" + +pkgname=disable-hyperthreading +pkgver=20180712 +pkgrel=1 +pkgdesc="OpenRC disable-hyperthreading init script" +arch=('any') +url="https://github.com/artix-linux/packages" +license=('GPL2') +groups=('openrc-system') +install=${pkgname}.install +depends=('openrc' 'cronie') +backup=('etc/disable-hyperthreading') +source=("disable-hyperthreading") +sha256sums=('f718a290526cd74bb3e19af7793321f25a41a9d71d286552d9127eeb32f93c99') + +pkgver() { + date +%Y%m%d +} + +package() { + install -Dm744 ${srcdir}/disable-hyperthreading ${pkgdir}/etc/disable-hyperthreading + +} diff --git a/disable-hyperthreading b/disable-hyperthreading new file mode 100644 index 0000000..a176e2a --- /dev/null +++ b/disable-hyperthreading @@ -0,0 +1,14 @@ +#!/bin/bash +for CPU in /sys/devices/system/cpu/cpu[0-9]*; do + CPUID=`basename $CPU | cut -b4-` + echo -en "CPU: $CPUID\t" + [ -e $CPU/online ] && echo "1" > $CPU/online + THREAD1=`cat $CPU/topology/thread_siblings_list | cut -f1 -d,` + if [ $CPUID = $THREAD1 ]; then + echo "-> enable" + [ -e $CPU/online ] && echo "1" > $CPU/online + else + echo "-> disable" + echo "0" > $CPU/online + fi +done diff --git a/disable-hyperthreading.install b/disable-hyperthreading.install new file mode 100644 index 0000000..9aecba2 --- /dev/null +++ b/disable-hyperthreading.install @@ -0,0 +1,13 @@ + +pre_install() { + cat <<EOM + == Important == + remember to activate the cron script by adding + @reboot root /etc/disable-hyperhtreading + to your /etc/crontab +EOM +} + +pre_upgrade() { + pre_install +} |