Re: Need some help in interpreting a code snippet

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 10, 2009 at 1:54 PM, Nagaprabhanjan Bellari
<nagp.knb@xxxxxxxxx> 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

What this simply does is that it ensure that the kernel wasn't
preempted anytime before calling h->action(h)

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux