#! /usr/bin/bash if [ $# -lt 1 ]; then echo " pinirq: pin irq of specified device to last processor" echo " Usage: sudo ./pinirq device_name" echo " Example: sudo ./pinirq eno1" exit fi irqnum=$(cat /proc/interrupts | grep $1 | tr ":" "\n" | head -1 | tr -d ' ' ) if [ -z $irqnum ]; then echo Device $1 not found! exit fi cores=$(grep -c 'cpu[0-9]' /proc/stat) coresm1=cores-1 declare -i NewMask=2**coresm1 echo Cores: $cores echo Old CPU Mask: $(cat /proc/irq/$irqnum/smp_affinity) echo $NewMask > /proc/irq/$irqnum/smp_affinity CPUMask=$(cat /proc/irq/$irqnum/smp_affinity) echo "Set device "$1" IRQ" $irqnum "CPU mask to" $CPUMask