Using ithread to deal with the network packet…

2009-05-13 04:02:38来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

We aften use callout, kthread and ithread in real time work, special in the kernel.

I tested callout, normal kthread and ithread in my test module that add a hook in the ether_input and ether_output functions and dispatch the mbuf to the ether_demux and ether_output_frame directly.

Callout: schedules the function after given time, and must reset again. In this case, interrupt/context/cpu is average. The big problem is the packets will be delay. The value of interrupt and context are in direct radio with HZ.

Kthread: like the thread of user space, ktread use suspend or sleep to give up CPU. But in heavy network traffic, sleep is too long, even one tick, and the packet queue will be filled full in a very short time. In my test, the value of interrupt is lower, but the value of context is very high. There is no way to give up CPU freely, context is heavy while using sleep, CPU is busy while using "pause" or "rep;nop" assemble instruction.

At last, I use ithread to deal with the network packtes instead of kthread. As we know, the ithread, is the kernel thread that triggered by an interrupt. It is easy that use swi_add to register an interrupt thread.
The value of interrupt is about 230400, an increase of about 3% as compared with the normal tcp stack. The value of context reached about 32250, a 30% increase compared to the normal.


tested box: Xeon 2.4 x 2, 1G memroy, Intel GB NIC
packet generator: Smartbit 6000 with GB module, 128-512Bytes/frame.



本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/132/showart_145546.html

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:FreeBSD 系统日志

下一篇:The man page of ithread in 6.x is expired!