ldata_create Kernel Service

Purpose

Creates a SRAD-aware pinned storage element pool (ldata pool) and returns its handle.

Syntax

#include <sys/ldata.h>

int ldata_create (size, initcount, maxcount, kkey, ldatap)

size_t size; 
long initcount; 
long maxcount;
kkey_t kkey;
ldata_t * ldatap;

Description

The ldata_create kernel service creates a SRAD-aware pool (ldata pool) of pinned storage elements, each of the specified size, and returns a handle to the newly-allocated pool. An ldata pool consists of a number of sub-pools (one per SRAD). Each sub-pool is physically backed with memory local to its corresponding SRAD. The size of each sub-pool is equal to the value of the maxcount parameter multiplied by the value of the size parameter. The parameter (initcount) specifies the number of pinned storage elements in each sub-pool that should be pre-allocated.

The ldata pool can be created with a kernel storage protection key by specifying one through the kkey parameter. For compatibility with previous releases, a kkey parameter of zero requests no protection. When a protection key is specified, the caller must hold this key when calling any ldata service, including the ldata_create kernel service.

After an ldata pool is created, its handle can be used to allocate pinned storage elements from the pool through the ldata_alloc kernel service and free these elements to the pool through the ldata_free kernel services. Elements are allocated and freed to the sub-pool corresponding to the SRAD on which ldata_alloc and ldata_free are called. If a sub-pool is exhausted of its pinned storage elements, it can be grown by calling the ldata_grow kernel service up to maxcount.

An ldata pool created through the ldata_create service can be destroyed by the ldata_destroy kernel service.

Parameters

Item Description
size Specifies the size, in bytes, of each pinned storage element of the ldata pool.
initcount Specifies the initial count of pinned storage elements, to be contained within the ldata pool. Must be a positive integer.
maxcount Specifies the maximum count of pinned storage elements that can be contained with the ldata pool. The value of maxcount must be positive and greater than or equal to the value of initcount.
kkey Specifies the kernel storage protection key to be applied to the newly created ldata pool. The value must be a valid kernel key number, or zero to indicate that storage protection is not requested.
ldatap Specifies an address to be set on successful completion with the handle for the newly created ldata pool.

Execution Environment

The ldata_create kernel service can be called only from the process environment.

Return Values

Item Description
0 Completed successfully. The handle for ldata storage is returned in ldatap.
EINVAL Invalid input parameters given. Invalid initcount, maxcount or kkey. The ldatap parameter is undefined.
ENOMEM Error encountered. Insufficient memory to satisfy request. The ldatap parameter is undefined.

Implementation Specifics

The ldata_create kernel service is part of the Base Operating System (BOS) Runtime.