Can contigmalloc(9) fail even when M_NOWAIT is *not* specified?
O'Connor, Daniel
darius at dons.net.au
Tue Jul 10 02:06:14 UTC 2018
> On 9 Jul 2018, at 17:02, Andriy Gapon <avg at freebsd.org> wrote:
> On 09/07/2018 09:21, Pratyush Yadav wrote:
>> Hi,
>>
>> The contigmalloc(9) man page says:
>>
>>> The contigmalloc() function does not sleep waiting for memory resources
>>> to be freed up, but instead actively reclaims pages before giving up.
>>> However, unless M_NOWAIT is specified, it may select a page for reclama-
>>> tion that must first be written to backing storage, causing it to sleep.
>>
>> So if M_NOWAIT is *not* specified, can contigmalloc() "give up", and
>> return NULL?
>
> Yes.
This seems pretty surprising to me.. Perhaps the man page could have a warning about it - right now it fairly strongly implies that !M_NOWAIT will wait forever.
--
Daniel O'Connor
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
More information about the freebsd-hackers
mailing list