On Thu, Dec 10, 2009 at 5:24 PM, Nagaprabhanjan Bellari
<[email protected]> wrote:
> The code snippet is in linux/kernel/softirq.c:__do_softirq():
> ==
>     do {
>         if (pending & 1) {
>             int preempt_count = preempt_count();
>             h->action(h);
>             if (preempt_count != preempt_count()) {
>                 printk(KERN_CRIT "BUG: softirq: %p, %x,%x\n",
>                     h->action, preempt_count, preempt_count());
>                 dump_crit_stack();
>             }
>             rcu_bh_qsctr_inc(cpu);
>         }
> ==
> What I am trying to understand is the preempt_count check after
> h->action(h); statement. Can somebody tell me why such a prempt_count
> mismatch check is made and why a mismatch is critical?
> Thanks,
> -nagp



This code checks whether the handler of softirq (h->action()) is
releasing every spin lock that it takes. If not, then preempt count
before and after calling handler will be different therefore softirq
thread will panic and dump the stack. Hope this answers your question.


-Vinit

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to [email protected]
Please read the FAQ at http://kernelnewbies.org/FAQ

Reply via email to