简体   繁体   English

Linux-内核线程抢占

[英]linux - kernel thread preemption

I've got some realtime linux kernel and I'm developing some code with kernel thread. 我有一些实时Linux内核,并且正在使用内核线程开发一些代码。 This thread is called by ethernet interrupt handler. 以太网中断处理程序调用此线程。 I noticed that every call of this thread takes about 100 jiffies. 我注意到此线程的每次调用大约需要100个jiffies。 In this time it reads about 256 ethernet frames. 此时,它读取约256个以太网帧。 The ethernet is 1Gbps and download speed which I measured is about 4MB/s. 以太网为1Gbps,我测得的下载速度约为4MB / s。 I think that 4MB/s speed using 1Gbps ethernet is far too slow. 我认为使用1Gbps以太网的4MB / s速度太慢了。

I'm trying to profile this kernel thread, because I think that 100 jiffies is too much. 我正在尝试对此内核线程进行概要分析,因为我认为100个jiffies太多了。 I'd like to ask if there is any way to tell how many times this kernel thread has been preempted? 我想问一下是否有任何方法可以知道该内核线程被抢占了多少次?

If you are inside the thread, you can give a try with the following printk("preempt count is %d\\n",current_thread_info()->preempt_count); 如果您在线程内,则可以尝试使用以下printk("preempt count is %d\\n",current_thread_info()->preempt_count);

You can add this at the entry of the thread and check the count difference between successive prints 您可以在线程的入口处添加它,并检查连续打印之间的计数差异

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM