From c2b3fb7236130e05a1b911ad85f563f1e4fc7407 Mon Sep 17 00:00:00 2001 From: Masamichi Takagi Date: Fri, 16 Sep 2016 19:07:07 +0900 Subject: [PATCH] Modify interrupt load balancing policy on reboot/stop * Fix the timing of stopping irqbalance when booting McKernel --- arch/x86/tools/mcreboot-smp-x86.sh.in | 19 ++++++++++++++----- arch/x86/tools/mcstop+release-smp-x86.sh.in | 2 +- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/arch/x86/tools/mcreboot-smp-x86.sh.in b/arch/x86/tools/mcreboot-smp-x86.sh.in index 3f9c58c8..76990ce3 100644 --- a/arch/x86/tools/mcreboot-smp-x86.sh.in +++ b/arch/x86/tools/mcreboot-smp-x86.sh.in @@ -28,6 +28,12 @@ LOGMODE=0 facility="LOG_LOCAL6" chown_option=`logname 2> /dev/null` +if [ "`systemctl status irqbalance_mck.service 2> /dev/null |grep -E 'Active: active'`" != "" -o "`systemctl status irqbalance.service 2> /dev/null |grep -E 'Active: active'`" != "" ]; then +irqbalance_used="yes" +else +irqbalance_used="no" +fi + while getopts :i:k:c:m:o:f: OPT do case ${OPT} in @@ -107,6 +113,12 @@ if [ "$enable_mcoverlay" == "yes" ]; then fi fi +# Stop irqbalance +if [ "${irqbalance_used}" == "yes" ]; then + systemctl stop irqbalance_mck.service 2>/dev/null + if ! systemctl stop irqbalance.service 2>/dev/null ; then echo "error: stopping irqbalance" >&2; exit 1; fi; +fi + # Load IHK if not loaded if [ "`lsmod | grep ihk`" == "" ]; then if ! insmod ${KMODDIR}/ihk.ko; then echo "error: loading ihk" >&2; exit 1; fi; @@ -212,11 +224,8 @@ then SBINDIR=${SBINDIR} ${SBINDIR}/mcklogd -i ${INTERVAL} -f ${facility} fi -# Modify interrupt load-balance policy -if [ "`systemctl status irqbalance_mck.service 2> /dev/null |grep -E 'Active: active'`" != "" -o "`systemctl status irqbalance.service 2> /dev/null |grep -E 'Active: active'`" != "" ]; then - systemctl stop irqbalance_mck.service 2>/dev/null - if ! systemctl stop irqbalance.service 2>/dev/null ; then echo "error: stopping irqbalance" >&2; exit 1; fi; - +# Start irqbalance with CPUs and IRQ for McKernel banned +if [ "${irqbalance_used}" == "yes" ]; then if ! etcdir=@ETCDIR@ perl -e 'use File::Copy qw(copy); $etcdir=$ENV{'etcdir'}; @files = grep { -f } glob "/proc/irq/*/smp_affinity"; foreach $file (@files) { $rel = substr($file, 1); $dir=substr($rel, 0, length($rel)-length("/smp_affinity")); if(0) { print "cp $file $etcdir/$rel\n";} if(system("mkdir -p $etcdir/$dir")){ exit 1;} if(!copy($file,"$etcdir/$rel")){ exit 1;} }' ; then echo "error: saving /proc/irq/*/smp_affinity" >&2; exit 1; fi; ncpus=`lscpu | grep -E '^CPU\(s\):' | awk '{print $2}'` diff --git a/arch/x86/tools/mcstop+release-smp-x86.sh.in b/arch/x86/tools/mcstop+release-smp-x86.sh.in index 9010b26c..7b727174 100644 --- a/arch/x86/tools/mcstop+release-smp-x86.sh.in +++ b/arch/x86/tools/mcstop+release-smp-x86.sh.in @@ -53,7 +53,7 @@ fi # Stop mcklogd pkill mcklogd -# Restore interrupt load-balance policy +# Start irqbalance with the original settings if [ "`systemctl status irqbalance_mck.service 2> /dev/null |grep -E 'Active: active'`" != "" ]; then if ! systemctl stop irqbalance_mck.service 2>/dev/null ; then echo "error: stopping irqbalance_mck" >&2; exit 1; fi; if ! systemctl disable irqbalance_mck.service >/dev/null 2>/dev/null; then echo "error: disabling irqbalance_mck" >&2; exit 1; fi;