Source-Changes archive

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

Re: CVS commit: src/sys/kern



On Tue, Oct 16, 2007 at 11:14:50AM +0000, Joerg Sonnenberger wrote:

> On Fri, Oct 12, 2007 at 01:00:18PM +0000, Andrew Doran wrote:
> > - Add crit_enter()/crit_exit(). These bound critical sections in which
> >   kernel preemption is to be disabled. Better names welcome.
> 
> How cheap are those

Something like:

crit_enter()
{
        curlwp->l_nopreempt++;
}

crit_exit()
{
        if (--curlwp->l_nopreempt == 0 && curlwp->l_dopreempt)
                preempt();
}

> and are they intended to replace short-term splhigh/splx use?

No, only to prevent real-time threads from preempting something else in the
kernel. Raising the spl should also do the same since the preemption must
happen on return from interrupt, but that's overkill.

The Linux (preempt_disable) or Solaris (kpreempt_disable) names look more
reasonable.

Andrew



Home | Main Index | Thread Index | Old Index