tech-kern archive

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

Re: Kernel preemption



On Sun, Apr 27, 2008 at 12:21:05PM +0100, Andrew Doran wrote:
 > > > The below patch implments in-kernel preemption for the i386 port.
 > > 
 > > Is in-kernel preemption really worthwhile on multiprocessor machines?
 > 
 > Yes, I think so. There are long/slow code paths within the kernel.

Right, but is it better to handle these by preemption or by setting up
to yield the processor before/while locking?

 > > Given fine-grained locking it's not clear that it really helps much
 > > with scheduler latency, and it adds potentially quite a bit of
 > > overhead because you have to fiddle with interrupts for all spinlocks
 > > rather than just those that are touched by interrupt code. Plus it
 > > makes per-cpu stuff that much harder to work with.
 > 
 > We make extensive use of adaptive locks which can be preempted safely and
 > don't require playing about with the interrupt level, so it's not really a
 > problem for us. Only items that can be accessed from a hardware interrupt
 > handler are covered by pure spinlock, for example the scheduler, and that's
 > not preemptible anyway.

I suppose that's an advantage of adaptive locks I hadn't thought of. Hrm...

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


Home | Main Index | Thread Index | Old Index