博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CPU亲和性
阅读量:4117 次
发布时间:2019-05-25

本文共 1797 字,大约阅读时间需要 5 分钟。

脚本如下:

setting up irq affinity according to /proc/interrupts

2008-11-25 Robert Olsson

2009-02-19 updated by Jesse Brandeburg

#

> Dave Miller:

(To get consistent naming in /proc/interrups)

I would suggest that people use something like:

char buf[IFNAMSIZ+6];

#

sprintf(buf, “%s-%s-%d”,

netdev->name,

(RX_INTERRUPT ? “rx” : “tx”),

queue->index);

#

Assuming a device with two RX and TX queues.

This script will assign:

#

eth0-rx-0 CPU0

eth0-rx-1 CPU1

eth0-tx-0 CPU0

eth0-tx-1 CPU1

#

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  
    #echo
DEV mask= MASKfor/proc/irq/ IRQ/smp_affinity
#echo MASK>/proc/irq/ IRQ/smp_affinity
}
if [ “ 1=];thenechoDescription:echoThisscriptattemptstobindeachqueueofamultiqueueNICechotothesamenumberedcore,ietx0¦rx0>cpu0,tx1¦rx1>cpu1echousage:echo 0 eth0 [eth1 eth2 eth3]”
fi

check for irqbalance running

IRQBALANCE_ON=ps ax ¦ grep -v grep ¦ grep -q irqbalance; echo $?

if [ “$IRQBALANCE_ON” == “0” ] ; then
echo ” WARNING: irqbalance is running and will”
echo ” likely override this script’s affinitization.”
echo ” Please stop the irqbalance service and/or execute”
echo ” ‘killall irqbalance’”
fi
#

Set up the desired devices.

#

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/

你可能感兴趣的文章
在Eclipse中查看Android源码
查看>>
Android-Socket登录实例
查看>>
Android使用webservice客户端实例
查看>>
层在页面中的定位
查看>>
[转]C语言printf
查看>>
C 语言 学习---获取文本框内容及字符串拼接
查看>>
C 语言学习 --设置文本框内容及进制转换
查看>>
C 语言 学习---判断文本框取得的数是否是整数
查看>>
C 语言 学习---ComboBox相关、简单计算器
查看>>
C 语言 学习---ComboBox相关、简易“假”管理系统
查看>>
C 语言 学习---回调、时间定时更新程序
查看>>
C 语言 学习---复选框及列表框的使用
查看>>
第四章 - 程序计数器
查看>>
第七章 - 本地方法栈
查看>>
第十一章 - 直接内存
查看>>
JDBC核心技术 - 上篇
查看>>
JDBC核心技术 - 下篇
查看>>
一篇搞懂Java反射机制
查看>>
【2021-MOOC-浙江大学-陈越、何钦铭-数据结构】树
查看>>
MySQL主从复制不一致的原因以及解决方法
查看>>