Jump to content

ksoftirqd_CPU0 using 99% CPU?


Peep
 Share

Recommended Posts

don't know if this helps, but i found this info doing a Google Search for ksoftirqd .

 

5.3 Softirq

 

When an IRQ comes, task switching is deferred until later to get better performance. Some Task jobs (that could have to be done just after the IRQ and that could take much CPU in interrupt time, like building up a TCP/IP packet) are queued and will be done at scheduling time (once a time-slice will end).

 

In recent kernels (2.4.x) the softirq mechanisms are given to a kernel_thread: ''ksoftirqd_CPUn''. n stands for the number of CPU executing kernel_thread (in a monoprocessor system ''ksoftirqd_CPU0'' uses PID 3).

 

Preparing Softirq

Enabling Softirq

 

''cpu_raise_softirq'' is a routine that will wake_up ''ksoftirqd_CPU0'' kernel thread, to let it manage the enqueued job.

 

|cpu_raise_softirq

  |__cpu_raise_softirq

  |wakeup_softirqd

     |wake_up_process

 

   * cpu_raise_softirq [kernel/softirq.c]

   * __cpu_raise_softirq [include/linux/interrupt.h]

   * wakeup_softirq [kernel/softirq.c]

   * wake_up_process [kernel/sched.c]

 

''__cpu_raise_softirq'' routine will set right bit in the vector describing softirq pending.

 

''wakeup_softirq'' uses ''wakeup_process'' to wake up ''ksoftirqd_CPU0'' kernel thread.

 

Executing Softirq

 

TODO: describing data structures involved in softirq mechanism.

 

When kernel thread ''ksoftirqd_CPU0'' has been woken up, it will execute queued jobs

 

The code of ''ksoftirqd_CPU0'' is (main endless loop):

 

for (;;) {

  if (!softirq_pending(cpu))  

     schedule();

     __set_current_state(TASK_RUNNING);

  while (softirq_pending(cpu)) {  

     do_softirq();  

     if (current->need_resched)  

        schedule  

  }

  __set_current_state(TASK_INTERRUPTIBLE)

}

 

   * ksoftirqd [kernel/softirq.c]

 

Chris

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

×
×
  • Create New...