Print this page
5513 KM_NORMALPRI should be documented in kmem_alloc(9f) and kmem_cache_create(9f) man pages
14465 Present KM_NOSLEEP_LAZY as documented interface
Change-Id: I002ec28ddf390650f1fcba1ca94f6abfdb241439
@@ -28,13 +28,19 @@
Number of bytes to allocate.
flag
Determines whether caller can sleep for memory. Possible flags
- are KM_SLEEP to allow sleeping until memory is available, or
- KM_NOSLEEP to return NULL immediately if memory is not
- available.
+ are KM_SLEEP to allow sleeping until memory is available,
+ KM_NOSLEEP to return NULL if memory is not available even after
+ some reclamation attempts, and KM_NOSLEEP_LAZY to return NULL
+ without reclamation attempts. KM_NOSLEEP_LAZY is actually two
+ flags combined: (KM_NOSLEEP | KM_NORMALPRI), the latter flag
+ indicating not to attempt reclamation before giving up and
+ returning NULL. If any mention of KM_NOSLEEP appears in this
+ man page by itself, it applies equally to KM_NOSLEEP_LAZY as
+ well.
buf
Pointer to allocated memory.
@@ -43,14 +49,16 @@
The kmem_alloc() function allocates size bytes of kernel memory and
returns a pointer to the allocated memory. The allocated memory is at
least double-word aligned, so it can hold any C data structure. No
greater alignment can be assumed. flag determines whether the caller
can sleep for memory. KM_SLEEP allocations may sleep but are
- guaranteed to succeed. KM_NOSLEEP allocations are guaranteed not to
- sleep but may fail (return NULL) if no memory is currently available.
- The initial contents of memory allocated using kmem_alloc() are random
- garbage.
+ guaranteed to succeed. KM_NOSLEEP and KM_NOSLEEP_LAZY allocations are
+ guaranteed not to sleep but may fail (return NULL) if no memory is
+ currently available. KM_NOSLEEP will first attempt to aggressively
+ reclaim memory from otherwise unused blocks, while KM_NOSLEEP_LAZY will
+ not attempt any reclamation. The initial contents of memory allocated
+ using kmem_alloc() are random garbage.
The kmem_zalloc() function is like kmem_alloc() but returns zero-filled
memory.