tech-kern archive

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

Re: allocating memory during kernel startup



On Fri, May 07, 2010 at 11:19:58AM +0900, Masao Uebayashi wrote:
> On Thu, May 06, 2010 at 02:32:57PM -0400, Michael wrote:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA1
> > 
> > Hello,
> > 
> > I recently ran into this problem - there is no easy way to determine
> > wether it is safe to call kmem_alloc() yet ( as in, are we far
> > enough through startup ) and when we call it too early the whole
> > thing just hangs.
> 
> We have no clear definition of the kernel state - what is boot, startup,
> and when it's done.
> 
> > Any chance to just have kmem_alloc() immediately return NULL if it
> > isn't ready yet so we can fail gracefully instead of hanging?
> 
> I like panic().

Even better, KASSERT().

> I think that complicating memory allocation in bootstrap is not a good
> thing.  What is your purpose?

Right, on the face of it I don't see why this is something to be handled at
runtime.

> Masao
> 
> > 
> > have fun
> > Michael
> > 
> > -----BEGIN PGP SIGNATURE-----
> > Version: GnuPG v1.4.7 (Darwin)
> > 
> > iQEVAwUBS+MLWcpnzkX8Yg2nAQIQUAf/S9Sr9flxPytiLSIoQ9TqLx3NraBPKF0x
> > SFQMVRnvHDR2imaexL1lab/tdrwmZcs1uUvmgdDravx8DfYEm6k7Y3rzr273T2b2
> > LuXQC5OxEL3ZRfhAYbWn06nEdDGoBDxlzz7bNT1TY7T7+6ZQeweyX51Ez89RM3us
> > MpeDeLAAPWtXaSm5Yo1jf7j7Uz0cblENkUetxp2YvUPKIHGRLn1iz0Xn7bdYqdHN
> > XaQi2WrE4Rsw8ee9se/NJdqFprsUaQLwRsSLGxm1FMYTho8IaOlX8i3z/tARMGpe
> > 3cRfHzS7ARGyjlWXJTPm1TtcXa5+0S4v9RoqJrDowNC6r3699RkqUg==
> > =AP9s
> > -----END PGP SIGNATURE-----
> 
> -- 
> Masao Uebayashi / Tombi Inc. / Tel: +81-90-9141-4635


Home | Main Index | Thread Index | Old Index