Changeset View
Changeset View
Standalone View
Standalone View
share/man/man9/contigmalloc.9
Show First 20 Lines • Show All 44 Lines • ▼ Show 20 Lines | |||||
.Fa "vm_paddr_t boundary" | .Fa "vm_paddr_t boundary" | ||||
.Fc | .Fc | ||||
.Ft void | .Ft void | ||||
.Fo contigfree | .Fo contigfree | ||||
.Fa "void *addr" | .Fa "void *addr" | ||||
.Fa "unsigned long size" | .Fa "unsigned long size" | ||||
.Fa "struct malloc_type *type" | .Fa "struct malloc_type *type" | ||||
.Fc | .Fc | ||||
.In sys/param.h | |||||
.In sys/domainset.h | |||||
.Ft "void *" | |||||
.Fo contigmalloc_domainset | |||||
.Fa "unsigned long size" | |||||
.Fa "struct malloc_type *type" | |||||
.Fa "struct domainset *ds" | |||||
.Fa "int flags" | |||||
.Fa "vm_paddr_t low" | |||||
.Fa "vm_paddr_t high" | |||||
.Fa "unsigned long alignment" | |||||
.Fa "vm_paddr_t boundary" | |||||
.Fc | |||||
.Sh DESCRIPTION | .Sh DESCRIPTION | ||||
The | The | ||||
.Fn contigmalloc | .Fn contigmalloc | ||||
function allocates | function allocates | ||||
.Fa size | .Fa size | ||||
bytes of contiguous physical memory that is aligned to | bytes of contiguous physical memory that is aligned to | ||||
.Fa alignment | .Fa alignment | ||||
bytes, and which does not cross a boundary of | bytes, and which does not cross a boundary of | ||||
.Fa boundary | .Fa boundary | ||||
bytes. | bytes. | ||||
If successful, the allocation will reside between physical addresses | If successful, the allocation will reside between physical addresses | ||||
.Fa low | .Fa low | ||||
and | and | ||||
.Fa high . | .Fa high . | ||||
The returned pointer points to a wired kernel virtual | The returned pointer points to a wired kernel virtual | ||||
address range of | address range of | ||||
.Fa size | .Fa size | ||||
bytes allocated from the kernel virtual address (KVA) map. | bytes allocated from the kernel virtual address (KVA) map. | ||||
.Pp | .Pp | ||||
The | The | ||||
.Fn contigmalloc_domainset | |||||
variant allows the caller to additionally specify a | |||||
.Xr numa 4 | |||||
domain selection policy. | |||||
See | |||||
.Xr domainset 9 | |||||
for some example policies. | |||||
.Pp | |||||
The | |||||
.Fa flags | .Fa flags | ||||
parameter modifies | parameter modifies | ||||
.Fn contigmalloc Ns 's | .Fn contigmalloc Ns 's | ||||
behaviour as follows: | behaviour as follows: | ||||
.Bl -tag -width indent | .Bl -tag -width indent | ||||
.It Dv M_ZERO | .It Dv M_ZERO | ||||
Causes the allocated physical memory to be zero filled. | Causes the allocated physical memory to be zero filled. | ||||
.It Dv M_NOWAIT | .It Dv M_NOWAIT | ||||
Causes | Causes | ||||
.Fn contigmalloc | .Fn contigmalloc | ||||
to return | to return | ||||
.Dv NULL | .Dv NULL | ||||
if the request cannot be immediately fulfilled due to resource shortage. | if the request cannot be immediately fulfilled due to resource shortage. | ||||
.El | .El | ||||
.Pp | .Pp | ||||
Other flags (if present) are ignored. | Other flags (if present) are ignored. | ||||
.Pp | .Pp | ||||
The | The | ||||
.Fn contigfree | .Fn contigfree | ||||
function deallocates memory allocated by a previous call to | function deallocates memory allocated by a previous call to | ||||
.Fn contigmalloc . | .Fn contigmalloc | ||||
or | |||||
.Fn contigmalloc_domainset . | |||||
.Sh IMPLEMENTATION NOTES | .Sh IMPLEMENTATION NOTES | ||||
The | The | ||||
.Fn contigmalloc | .Fn contigmalloc | ||||
function does not sleep waiting for memory resources to be freed up, | function does not sleep waiting for memory resources to be freed up, | ||||
but instead actively reclaims pages before giving up. | but instead actively reclaims pages before giving up. | ||||
However, unless | However, unless | ||||
.Dv M_NOWAIT | .Dv M_NOWAIT | ||||
is specified, it may select a page for reclamation that must first be | is specified, it may select a page for reclamation that must first be | ||||
Show All 38 Lines |