tech-kern archive

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

Re: mutexes, IPL, tty locking



On Thu, Oct 29, 2009 at 09:41:12PM +0000, Mindaugas Rasiukevicius wrote:
 > David Holland <dholland-tech%netbsd.org@localhost> wrote:
 > >    if (oldspl == highest && cur->l_iplcounts[highest-1] == 0) {
 > >       while (highest > 0 && cur->l_iplcounts[highest-1] == 0) {
 > >          highest--;
 > >       }
 > 
 > It would probably be better to use bitmask and ffs() right here, to avoid
 > looping through priorities.

Yes, except that you need the counts. Maintaining a mask as well as
the counts is probably more expensive than executing this loop once in
a while.

 > Anyway, this is some overhead in low level
 > primitive to support very rare cases.   I do not think it is worth.  Also,
 > the case in our TTY locking should be fixed be revamping it (i.e. having
 > locking in drivers).

I'm not sure it's as rare as all that; it just mostly doesn't overtly
fail. Instead you end up silently running at a higher IPL than
necessary, and that buys you longer interrupt latencies and more
dropped packets and all that.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index