Changeset View
Changeset View
Standalone View
Standalone View
head/share/man/man9/zone.9
Show All 19 Lines | |||||
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | ||||
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | ||||
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | ||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | ||||
.\" SUCH DAMAGE. | .\" SUCH DAMAGE. | ||||
.\" | .\" | ||||
.\" $FreeBSD$ | .\" $FreeBSD$ | ||||
.\" | .\" | ||||
.Dd November 22, 2019 | .Dd January 8, 2020 | ||||
.Dt UMA 9 | .Dt UMA 9 | ||||
.Os | .Os | ||||
.Sh NAME | .Sh NAME | ||||
.Nm UMA | .Nm UMA | ||||
.Nd general-purpose kernel object allocator | .Nd general-purpose kernel object allocator | ||||
.Sh SYNOPSIS | .Sh SYNOPSIS | ||||
.In sys/param.h | .In sys/param.h | ||||
.In sys/queue.h | .In sys/queue.h | ||||
▲ Show 20 Lines • Show All 250 Lines • ▼ Show 20 Lines | |||||
.Ed | .Ed | ||||
Note that | Note that | ||||
.Dv M_ZERO | .Dv M_ZERO | ||||
cannot be used when allocating items from a PCPU zone. | cannot be used when allocating items from a PCPU zone. | ||||
To obtain zeroed memory from a PCPU zone, use the | To obtain zeroed memory from a PCPU zone, use the | ||||
.Fn uma_zalloc_pcpu | .Fn uma_zalloc_pcpu | ||||
function and its variants instead, and pass | function and its variants instead, and pass | ||||
.Dv M_ZERO . | .Dv M_ZERO . | ||||
.It Dv UMA_ZONE_OFFPAGE | .It Dv UMA_ZONE_NOTOUCH | ||||
By default book-keeping of items within a slab is done in the slab page itself. | The UMA subsystem may not directly touch (i.e. read or write) the slab memory. | ||||
This flag explicitly tells subsystem that book-keeping structure should be | Otherwise, by default, book-keeping of items within a slab may be done in the | ||||
allocated separately from special internal zone. | slab page itself, and | ||||
This flag requires either | .Dv INVARIANTS | ||||
.Dv UMA_ZONE_VTOSLAB | kernels may also do use-after-free checking by accessing the slab memory. | ||||
or | |||||
.Dv UMA_ZONE_HASH , | |||||
since subsystem requires a mechanism to find a book-keeping structure | |||||
to an item being freed. | |||||
The subsystem may choose to prefer offpage book-keeping for certain zones | |||||
implicitly. | |||||
.It Dv UMA_ZONE_ZINIT | .It Dv UMA_ZONE_ZINIT | ||||
The zone will have its | The zone will have its | ||||
.Ft uma_init | .Ft uma_init | ||||
method set to internal method that initializes a new allocated slab | method set to internal method that initializes a new allocated slab | ||||
to all zeros. | to all zeros. | ||||
Do not mistake | Do not mistake | ||||
.Ft uma_init | .Ft uma_init | ||||
method with | method with | ||||
.Ft uma_ctor . | .Ft uma_ctor . | ||||
A zone with | A zone with | ||||
.Dv UMA_ZONE_ZINIT | .Dv UMA_ZONE_ZINIT | ||||
flag would not return zeroed memory on every | flag would not return zeroed memory on every | ||||
.Fn uma_zalloc . | .Fn uma_zalloc . | ||||
.It Dv UMA_ZONE_HASH | .It Dv UMA_ZONE_NOTPAGE | ||||
The zone should use an internal hash table to find slab book-keeping | An allocator function will be supplied with | ||||
structure where an allocation being freed belongs to. | .Fn uma_zone_set_allocf | ||||
.It Dv UMA_ZONE_VTOSLAB | and the memory that it returns may not be kernel virtual memory backed by VM | ||||
The zone should use special field of | pages in the page array. | ||||
.Vt vm_page_t | |||||
to find slab book-keeping structure where an allocation being freed belongs to. | |||||
.It Dv UMA_ZONE_MALLOC | .It Dv UMA_ZONE_MALLOC | ||||
The zone is for the | The zone is for the | ||||
.Xr malloc 9 | .Xr malloc 9 | ||||
subsystem. | subsystem. | ||||
.It Dv UMA_ZONE_VM | .It Dv UMA_ZONE_VM | ||||
The zone is for the VM subsystem. | The zone is for the VM subsystem. | ||||
.It Dv UMA_ZONE_NUMA | .It Dv UMA_ZONE_NUMA | ||||
The zone should use a first-touch NUMA policy rather than the round-robin | The zone should use a first-touch NUMA policy rather than the round-robin | ||||
▲ Show 20 Lines • Show All 272 Lines • Show Last 20 Lines |