Created
August 17, 2014 21:26
-
-
Save rooty/5190ebe06b261c3b7a22 to your computer and use it in GitHub Desktop.
Распределение IRQ процессоры
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
NUM=0 | |
CPUS= | |
for ARG in "$@" | |
do | |
if [ $NUM -eq 0 ]; then INTERFACE=$ARG; fi | |
if [ $NUM -gt 0 ]; then CPUS[$[$NUM-1]]=$ARG; fi | |
let NUM++ | |
done | |
if [ "$INTERFACE" != "" ] && [ "${CPUS[0]}" -ge 0 ] | |
then | |
CPU_INDEX=0 | |
for irq in `cat /proc/interrupts | grep $INTERFACE | awk '{print $1}' | sed s/\://g` | |
do | |
f="/proc/irq/$irq/smp_affinity" | |
test -r "$f" || continue | |
if [ "${CPUS[$CPU_INDEX]}" != "" ] && [ ${CPUS[$CPU_INDEX]} -ge 0 ] | |
then | |
MASK=`printf %x $[2 ** ${CPUS[$CPU_INDEX]}]` | |
printf "Assign SMP affinity: %-5s IRQ: %-2d CPU: %2d MASK: 0x%s\n" $INTERFACE $irq ${CPUS[$CPU_INDEX]} $MASK | |
echo "$MASK" > "$f" | |
fi | |
let CPU_INDEX++ | |
done | |
else | |
echo "Usage : $0 <INTERFACE> <CPU_LIST>" | |
echo "Example: $0 eth0 0 1 2 3" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment