missing error check in lwkt_alloc_thread

Matthew Dillon dillon at apollo.backplane.com
Fri Feb 23 10:58:23 PST 2007

    Update to my last comment:  We already have a kmem_alloc3() procedure
    which takes kmflags.

    So I suggest we add a KM_NULLOK flag and add code to kmem_alloc3() to
    panic if it is unable to allocate memory and KM_NULLOK was not passed 
    to it.

    kmem_alloc() is an inline function which just calls kmem_alloc3(..., 0),
    so it would not have to be changed.  Changing kmem_alloc3() to add this
    flag would cause kmem_alloc()'s semantics to change to 'panic instead of
    return NULL'.

    All callers of kmem_alloc() would have to be vetted and those cases 
    where it is ok to return NULL would be changed to a kmem_alloc3() call
    that passes KM_NULLOK.


More information about the Kernel mailing list