Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
# from
ncpus=`grep -ciw ^processor /proc/cpuinfo`
test "$ncpus" -gt 1 || exit 1
for irq in `cat /proc/interrupts | grep eth | awk '{print $1}' | sed s/\://g`
test -r "$f" || continue
cpu=$[$ncpus - ($n % $ncpus) - 1]
if [ $cpu -ge 0 ]
mask=`printf %x $[2 ** $cpu]`
echo "Assign SMP affinity: eth queue $n, irq $irq, cpu $cpu, mask 0x$mask"
echo "$mask" > "$f"
let n+=1
done is yours

cat /proc/interrupts | grep eth | awk '{print $1}' | sed s/\://g
awk -F"[ :]" '/eth/{print $1}' /proc/interrupts

hit0ri commented Jun 25, 2015

You can replace line 4 with this:


pavel-odintsov commented Jun 26, 2015

Thanks for feedback! But it's very draft tool and you could fix it as you want :)

Intel provides with their drivers, that can do that + XPS and NUMA:

jwbensley commented Sep 9, 2017

@hit0ri - The problem with nrpoc is that if you are using isolcpu/nohz_full/rcu_nocbs it won't count those CPUs. Example case, we set nohz_full=1-15 isolcpus=1-15 rcu_nocbs=1-15 and use core 0 for OS, nproc returns 1 instead of 16.

ncpus=`grep -ciw ^processor /proc/cpuinfo` works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment