[TriLUG] kernel question
Matt Hoover
Matt.Hoover at haht.com
Tue Jul 15 10:43:45 EDT 2003
The good news is that a SMP kernel will work fine on a
Uniprocessor system. The bad news is that there is a
performance hit.
Now for those interested in the details, the reason for
the performance hit is that the kernel has to do additional
locking on SMP. On a Uniprocessor system, the kernel can
disable interrupts, and be assured that nothing else is going
to modify memory. But on a SMP system, another processor
can modify memory. So the solution is to add locks (often
called spinlocks) for various parts of memory. What happens
is when a processor wants to access memory protected by a
lock, it first gets the lock. In order to get the lock,
the processor goes into a tight loop until the lock is available.
Once it has acquired the lock, it accesses the memory, and
then releases the lock so other processors can get it. Acquiring
and releasing locks has a certain amount of overhead, even if
there are no other processors making the current processor wait
for the lock. So in the Uniprocessor kernel, where spinlocks
aren't needed, the kernel replaces the get and release spinlock
code with no-ops, which get optimized away.
One other thing to note is that this applies to the 2.4.x and 2.2.x
series kernels. In 2.5.x, and now 2.6.x, pre-emption support has
been added to the kernel. Therefore, spinlocks are needed even
on a Uniprocessor system (if pre-emption has been enabled in the
config)
> -----Original Message-----
> From: Greg Brown [mailto:gregbrown at mindspring.com]
> Sent: Tuesday, July 15, 2003 8:31 AM
> To: trilug at trilug.org
> Subject: [TriLUG] kernel question
>
>
> If I accidently included symmetric multi-processing support into my
> kernel on a machine which has only one processor. By including this
> option do I face and kind of a performance hit on my single processor
> machine? Even though I did include this option built-into my
> kernel I
> did not compile the kernel with options telling it to compile for N
> number of processors. I'm running the 2.4.21 kernel. If the
> kernel is
> fine as-is I'll just leave well enough alone until I upgrade
> again - if
> not, I'll recompile. Thoughts? Anyone? Bueller? Fry?
>
> Greg
>
> --
> TriLUG mailing list :
> http://www.trilug.org/mailman/listinfo/trilug
> TriLUG
> Organizational FAQ : http://trilug.org/faq/
> TriLUG Member Services FAQ : http://members.trilug.org/services_faq/
> TriLUG PGP Keyring : http://trilug.org/~chrish/trilug.asc
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.trilug.org/pipermail/trilug/attachments/20030715/65b3a9dc/attachment.html>
More information about the TriLUG
mailing list