DragonFly BSD
DragonFly submit List (threaded) for 2003-12
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: lwkt_msgport.c


From: David Rhodus <drhodus@xxxxxxxxx>
Date: Wed, 31 Dec 2003 18:08:03 -0500

On Dec 31, 2003, at 4:52 PM, esmith wrote:
It appears, on line 371 of lwkt_msgport.c, function lwkt_default_waitport, that there is a call to enter a critical section which might be unnecessary because it already exists within a critical section.

With the critical section code in DragonFly nesting of critical functions does not add very much overhead as its just a value being incremented by one.

From src/sys/sys/thread2.h

static __inline void
crit_enter(void)
{
    struct thread *td = curthread;

#ifdef INVARIANTS
    if (td->td_pri < 0)
        crit_panic();
#endif
    td->td_pri += TDPRI_CRIT;
}

If one were to add a simple print statement into crit_enter()
to print the current value of the nesting depth, you'll find we
are several hundreds deep already.

-DR




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