Slab Allocation

Functions and structures

slab_folio

slab_folio(s)

The folio allocated for a slab

Parameters

s

The slab.

Description

Slabs are allocated as folios that contain the individual objects and areusing some fields in the firststructpage of the folio - those fields arenow accessed bystructslab. It is occasionally necessary to convert back toa folio in order to communicate with the rest of the mm. Please use thishelper function instead of casting yourself, as the implementation may changein the future.

structslab*page_slab(conststructpage*page)

Converts fromstructpage to its slab.

Parameters

conststructpage*page

A page which may or may not belong to a slab.

Return

The slab which contains this page or NULL if the page doesnot belong to a slab. This includes pages returned from large kmalloc.

slab_page

slab_page(s)

The firststructpage allocated for a slab

Parameters

s

The slab.

Description

A convenience wrapper for converting slab to the firststructpage of theunderlying folio, to communicate with code not yet converted to folio orstructslab.

enumslab_flags

How the slab flags bits are used.

Constants

SL_locked

Is locked withslab_lock()

SL_partial

On the per-node partial list

SL_pfmemalloc

Was allocated from PF_MEMALLOC reserves

Description

The slab flags share space with the page flags but some bits havedifferent interpretations. The high bits are used for informationlike zone/node/section.