Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 21 Jan 1999 10:46:57 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        green@unixhelp.org, mike@smith.net.au
Cc:        current@FreeBSD.ORG
Subject:   Re: Truth to M_WAITOK?
Message-ID:  <199901202346.KAA13074@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>It looks like M_WAITOK will either return non-NULL or panic; it 
>shouldn't be capable of returning NULL.  Ideally, it shouldn't panic 
>either (why is it only that M_WAITOK can panic, and M_NOWAIT can't?).

Because failures for M_NOWAIT are normal (all pages may be in use,
and the caller is not prepared for pages top be freed by swapping).
Therefore, callers that set M_NOWAIT must be prepared for failure.  OTOH,
failures for M_WAITOK are abnormal, and at least for map == kmem_map (as
it is for calls to kmem_malloc() from malloc()), the correct handling
for failure is to panic since a full map is unlikely to become unfull
and neither the caller or kmem_malloc() can know what to do to unfill it.

Bruce

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901202346.KAA13074>