1IDR_PRELOAD(9)          Basic Kernel Library Functions          IDR_PRELOAD(9)
2
3
4

NAME

6       idr_preload - preload for idr_alloc
7

SYNOPSIS

9       void idr_preload(gfp_t gfp_mask);
10

ARGUMENTS

12       gfp_mask
13           allocation mask to use for preloading
14

DESCRIPTION

16       Preload per-cpu layer buffer for idr_alloc. Can only be used from
17       process context and each idr_preload invocation should be matched with
18       idr_preload_end. Note that preemption is disabled while preloaded.
19
20       The first idr_alloc in the preloaded section can be treated as if it
21       were invoked with gfp_mask used for preloading. This allows using more
22       permissive allocation masks for idrs protected by spinlocks.
23
24       For example, if idr_alloc below fails, the failure can be treated as if
25       idr_alloc were called with GFP_KERNEL rather than GFP_NOWAIT.
26
27       idr_preload(GFP_KERNEL); spin_lock(lock);
28
29       id = idr_alloc(idr, ptr, start, end, GFP_NOWAIT);
30
31       spin_unlock(lock); idr_preload_end; if (id < 0) error;
32
34Kernel Hackers Manual 3.10         June 2019                    IDR_PRELOAD(9)
Impressum