Discussion:
Can contigmalloc(9) fail even when M_NOWAIT is *not* specified?
Pratyush Yadav
2018-07-09 06:21:02 UTC
Permalink
Hi,
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?
--
Regards,
Pratyush Yadav
Conrad Meyer
2018-07-09 06:43:55 UTC
Permalink
Yes.
Post by Pratyush Yadav
Hi,
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?
--
Regards,
Pratyush Yadav
_______________________________________________
https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
Andriy Gapon
2018-07-09 07:32:47 UTC
Permalink
Post by Pratyush Yadav
Hi,
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.
--
Andriy Gapon
O'Connor, Daniel
2018-07-10 01:40:34 UTC
Permalink
Post by Pratyush Yadav
Hi,
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

Loading...