ldata Kernel Services

ldata stands for "local data". The ldata facility supports data localization by allowing kernel subsystems and extensions to create and use ldata pools.

The element size plus the initial and maximum number of elements to be contained in the pool is specified while creating the pool. The number of elements in the pool can be dynamically increased up to the maximum. Within the sub-pool the elements are contained such that they are cache-aligned and multiples of cache-line size to promote cache friendliness. Also, the elements in each sub-pool are backed by physical memory local to its corresponding SRAD. Allocation of a storage element is satisfied from the per-SRAD sub-pool on which the caller is located and where the storage element is to be predominately accessed. Deallocation of a storage element returns the element to its associated per-SRAD sub-pool.

Services are provided to allow kernel subsystems and extensions to create, destroy, grow the ldata pools. There are a couple of advantages of using ldata kernel services over raw xmallocs:
  1. Since the memory allocated by ldata kernel services are backed by local node memory, it is faster to read and write the ldata region on that node.
  2. ldata elements can be allocated from the interrupt environment. xmalloc kernel service cannot be called from the interrupt environment. Of course, there is an upper limit on a given ldata pool -- the maximum number of elements asked at ldata creation time.

The ldata services are:

Item Description
ldata_create Creates a SRAD-aware pinned storage element pool (ldata pool) and returns its handle.
ldata_destroy Destroys a ldata pool created by ldata_create.
ldata_grow Expands the count of available pinned storage elements contained within a ldata pool.
ldata_alloc Allocates a pinned storage element from a ldata pool.
ldata_free Frees a pinned storage element to a ldata pool.