Subject: Questions about memory allocation for device drivers.
To: None <netbsd-ports@netbsd.org, port-powerpc@netbsd.org, tech-ports@netbsd.org>
From: Mark Milligan <milligan@realtime.bc.ca>
List: tech-ports
Date: 08/23/2001 09:13:54
I have been looking thru the kernel code trying to understand how the ker=
nel
memory allocation works etc. and have noticed a few things.=20
When the autoconfig routine installs a device driver it mallocs some memo=
ry
for the softc device structure and this is passed to the driver to use. =20
see: sys/kern/subr_autoconf.c config_attach()
The malloc routine allocates memory from kernel space, I am not sure if t=
his
memory is wired down or not. I have noticed that some device drivers use=
this
memory for buffers (the 16550 com.c driver com_intr() ) while others us=
e the
bus_dma functions ( ethernet etc.) to guarantee they have wired down memo=
ry.
Is the softc driver memory wired down? or will it page? It seems to me i=
t
should be wired down and should not page. If they page should the autoco=
nf
routine force the memory to be wired down? This may improve the performa=
nce of=20
device drivers.
Also shouldnt the ISR routines be wired down so they do not page? My
understanding is that kernel code can be paged in and out.
Thanks in advance
--=20
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Mark Milligan
Real Time Systems Inc.