本文共 1797 字,大约阅读时间需要 5 分钟。
脚本如下:
#
#
#
#
#
set_affinity() { MASK= ((1<< VEC)) printf “%s mask=%X for /proc/irq/%d/smp_affinity\n” DEV MASK IRQprintf“ MASK > /proc/irq/IRQ/smp_affinity #echoDEV mask= MASKfor/proc/irq/ IRQ/smp_affinity #echo MASK>/proc/irq/ IRQ/smp_affinity } if [ “ 1”=“”];thenecho“Description:”echo”Thisscriptattemptstobindeachqueueofamulti−queueNIC”echo”tothesamenumberedcore,ietx0¦rx0–>cpu0,tx1¦rx1–>cpu1”echo“usage:”echo” 0 eth0 [eth1 eth2 eth3]” fiIRQBALANCE_ON=ps ax ¦ grep -v grep ¦ grep -q irqbalance; echo $?
#
for DEV in $* do for DIR in rx tx TxRx do MAX=grep $DEV-$DIR /proc/interrupts ¦ wc -l
if [ “$MAX” == “0” ] ; then MAX=egrep -i "$DEV:.*$DIR" /proc/interrupts ¦ wc -l
fi if [ “ MAX”==“0”];thenechono DIR vectors found on $DEV continue #exit 1 fi for VEC in seq 0 1 $MAX
do IRQ=cat /proc/interrupts ¦ grep -i $DEV-$DIR-$VEC"$" ¦ cut -d: -f1 ¦ sed "s/ //g"
if [ -n “$IRQ” ]; then set_affinity else IRQ=cat /proc/interrupts ¦ egrep -i $DEV:v$VEC-$DIR"$" ¦ cut -d: -f1 ¦ sed "s/ //g"
if [ -n “$IRQ” ]; then set_affinity fi fi done done done 转载地址:http://iaypi.baihongyu.com/