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

Re: SMP and device drivers performance



On Tue, Jun 25, 2002 at 09:16:24AM +0200, Roberto Granato wrote:
> It is not clear to me the (inner) behaviour of kernel on a SMP machine.
> Does kernel take advantage running on SMP?
> For example, a NIC driver runs on a processor and another module runs on
> another processor?

Any two pieces of kernel code that are not excluded via a semaphore,
spin-lock or big kernel lock can run at the same time on two CPUs.
So even two same pieces of code can run on two processors at the same
time. You must spin-lock if there is a race-condition.

In 2.0.x kernels when SMP first appeared, on every entry to kernel BKL
was locked, so kernel could run at only one CPU at a time. Since 2.1
kernel can run on all CPUs and BKL is used only for code where locking
is difficult or not resolved yet.

> I wonder if is it possible to make parallel computing in a kernel module.

Well, yes - in kernel threads. But tasks that need lot CPU don't belong
to kernel.

-------------------------------------------------------------------------------
						 Jan 'Bulb' Hudec <bulb@ucw.cz>
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/