BH implementation question

Anders Peter Fugmann (afu@fugmann.dhs.org)
Tue, 20 Mar 2001 18:42:01 +0100


Hi I have a couple of questions to the kernel code.

I have been trying to fully inderstand (and doccument) the changes in
2.4 wrt. Tasklets and softirq's, BH's and task queues.

In my try to understand how it all works, I came across the code:

(linux/kernel/softirq.c: 246)

static void bh_action(unsigned long nr)
{
int cpu = smp_processor_id();

if (!spin_trylock(&global_bh_lock))
goto resched;

if (!hardirq_trylock(cpu))
goto resched_unlock;

if (bh_base[nr])
bh_base[nr]();

hardirq_endlock(cpu);
spin_unlock(&global_bh_lock);
return;

resched_unlock:
spin_unlock(&global_bh_lock);
resched:
mark_bh(nr);
}

Now all of this but the hardirq_trylock(cpu) and hardirq_endlock(cpu)
makes perfectly sence.

Anyone care to explain the what theese lines do.

Secondly.

Is there a reason why to implement a queue (TASKLET_HI) for the old
BH's, instead of just using a single tasklet for all BH administraton.
Would'ent this guarentee that no BH is executed at the same time, and at
the same time reduce code complexity, and remove the global_bh_lock?

TIA
Anders Fugmann

-- 
Hi. I'm a .signature virus.
Please copy me into your .signature file and help me spread.

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/