从linux设备驱动程序更改smp_affinity [英] change smp_affinity from linux device driver

查看:963
本文介绍了从linux设备驱动程序更改smp_affinity的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我检查

cat /proc/interrupts 

命令,所有IRQ都列在SMP系统中的cpu0下. 我可以使用以下命令更改smp_affinity掩码以将IRQ标记为特定的CPU.

command, all the IRQs are listed under cpu0 in SMP system. I can change the smp_affinity mask to tag the IRQ to particular CPU using following command.

 echo "4" > /proc/irq/230/smp_affinity

以上命令将中断230的相似性掩码设置为CPU 2.

Above command sets the affinity mask of the interrupt 230 to CPU 2.

我想从linux内核模块获得相同的效果.我该怎么办?
我看到了create_proc_entry方法,该方法可以创建新的proc条目.
有什么方法可以用来编写现有的proc条目?

I would like achieve same from linux kernel module. How can I do this?
I see create_proc_entry method which allows to create new proc entry.
Is there any method which we can use to write existing proc entry?

推荐答案

在内核模块中,您可以直接调用内核API函数irq_set_affinity(...).无需通过/proc.请参阅: http://lxr.free-electrons.com/source /kernel/irq/manage.c#L189

In a kernel module you can just call the kernel API function irq_set_affinity(...) directly. No need to go through /proc. See: http://lxr.free-electrons.com/source/kernel/irq/manage.c#L189

这篇关于从linux设备驱动程序更改smp_affinity的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆