Subject: Re: m_get(), MGET(), and MGETHDR() with M_WAIT
To: Paul Kranenburg <pk@cs.few.eur.nl>
From: Chris G Demetriou <Chris_G_Demetriou@ux2.sp.cs.cmu.edu>
List: tech-kern
Date: 06/05/1996 16:33:50
> > What i'm wondering is, in their 'well-documented' definitions, are
> > they ever allowed to return NULL in that case?
> 
> Well, Stevens says that the return value of m_get() should always be checked,
> but his argument for this seems rather off the mark.
> 
> Looking at the definition of MGET() and m_retry(), it's obvious that the
> answer depends on whether `malloc(.., M_WAIT)'  can ever return NULL.
> It appears that it can, given that kmem_malloc() in vm_kern.c can.

no, malloc(... M_WAIT) _cannot_ return NULL.  Like i noted, that's the
current implementation, and i'm not as much concerned about that as I
am about what the code using m_get(... M_WAIT ...) _should_ be doing.

I'll take a look at my copy of Stevens tonight (forgot completely
about it...  I'm lame!).  If he says that m_get() should be checked,
then i believe that's correct, and the code in our tree which doesn't
check it should be fixed.

In the future, we might use a smarter mbuf allocator which will
actually limit allocations based on more criteria than the current one
does...  There's no point in ripping code out now, only to have to add
it back then.


chris