The FreeRADIUS server  $Id: 15bac2a4c627c01d1aa2047687b3418955ac7f00 $
Data Structures | Macros
slab.h File Reference

Resource pool management using slabs of memory. More...

#include <freeradius-devel/util/dlist.h>
#include <freeradius-devel/util/event.h>
+ Include dependency graph for slab.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  fr_slab_config_t
 Tuneable parameters for slabs. More...
 

Macros

#define FR_SLAB_CONFIG_conf_parser_t
 conf_parser_t entries to populate user configurable slab values More...
 
#define FR_SLAB_FUNCS(_name, _type)
 Define type specific wrapper functions for slabs and slab elements. More...
 
#define FR_SLAB_TYPES(_name, _type)
 Define type specific wrapper structs for slabs and slab elements. More...
 

Detailed Description

Resource pool management using slabs of memory.

Definition in file slab.h.


Data Structure Documentation

◆ fr_slab_config_t

struct fr_slab_config_t

Tuneable parameters for slabs.

Definition at line 42 of file slab.h.

+ Collaboration diagram for fr_slab_config_t:
Data Fields
bool at_max_fail Should requests for additional elements fail when the number in use has reached max_elements.
size_t child_pool_size Size of pool space to be allocated to each element.
unsigned int elements_per_slab Number of elements to allocate per slab.
fr_time_delta_t interval Interval between slab cleanup events being fired.
unsigned int max_elements Maximum number of elements to allocate using slabs.
unsigned int min_elements Minimum number of elements to keep allocated.
unsigned int num_children How many child allocations are expected off each element.

Macro Definition Documentation

◆ FR_SLAB_CONFIG_conf_parser_t

#define FR_SLAB_CONFIG_conf_parser_t
Value:
{ FR_CONF_OFFSET("min", fr_slab_config_t, min_elements), .dflt = "10" }, \
{ FR_CONF_OFFSET("max", fr_slab_config_t, max_elements), .dflt = "100" }, \
{ FR_CONF_OFFSET("cleanup_interval", fr_slab_config_t, interval), .dflt = "30s" }, \
#define FR_CONF_OFFSET(_name, _struct, _field)
conf_parser_t which parses a single CONF_PAIR, writing the result to a field in a struct
Definition: cf_parse.h:268
Tuneable parameters for slabs.
Definition: slab.h:42

conf_parser_t entries to populate user configurable slab values

Definition at line 35 of file slab.h.

◆ FR_SLAB_FUNCS

#define FR_SLAB_FUNCS (   _name,
  _type 
)

Define type specific wrapper functions for slabs and slab elements.

Note
This macro should be used inside the source file that will use the type specific functions.
Parameters
[in]_nameused in type specific structures.
[in]_typeof structure returned by the reserve function.

Definition at line 120 of file slab.h.

◆ FR_SLAB_TYPES

#define FR_SLAB_TYPES (   _name,
  _type 
)

Define type specific wrapper structs for slabs and slab elements.

Note
This macro should be used inside the header for the area of code which will use the type specific slabs.

The top level structure is the slab_list. Slab elements are reserved from this list. One or more slabs are created as children of the slab_list each of which consist of a number of elements.

Within the slab_list there are two dlists which hold the slabs. Slabs in the reserved list have all their elements in use. Slabs in the avail list have elements available to reserve.

Allocation of new elements can cause an allocation callback to be invoked if elements need initialisation.

Parameters
[in]_nameto use in type specific structures.
[in]_typeof structure which will be held in the slab elements.

Definition at line 72 of file slab.h.