Распределение IRQ процессоры
#!/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