idr_preload(9)

idr_preload9

Preload for idr_alloc

Usage

void idr_preload(gfp_t gfp_mask);

Arguments

gfp_mask

allocation mask to use for preloading

Overview

Preload per-cpu layer buffer for idr_alloc. Can only be used from process context and each idr_preload invocation should be matched with idr_preload_end. Note that preemption is disabled while preloaded.

The first idr_alloc in the preloaded section can be treated as if it were invoked with gfp_mask used for preloading. This allows using more permissive allocation masks for idrs protected by spinlocks.

For example, if idr_alloc below fails, the failure can be treated as if idr_alloc were called with GFP_KERNEL rather than GFP_NOWAIT.

idr_preload(GFP_KERNEL); spin_lock(lock);

id = idr_alloc(idr, ptr, start, end, GFP_NOWAIT);

spin_unlock(lock); idr_preload_end; if (id < 0) error;

Releases

2 releases since Debian 8 (Jessie); the text changed 1 time.

  1. 8
  2. 9

From linux-manual-4.9 4.9.228-1 in Debian 9 (Stretch). Parsed by carta from the page's man source.