1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>idr_preload</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="The Linux Kernel API"><link rel="up" href="idr.html" title="idr/ida Functions"><link rel="prev" href="idr.html" title="idr/ida Functions"><link rel="next" href="API-idr-alloc.html" title="idr_alloc"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center"><span class="phrase">idr_preload</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="idr.html">Prev</a> </td><th width="60%" align="center">idr/ida Functions</th><td width="20%" align="right"> <a accesskey="n" href="API-idr-alloc.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-idr-preload"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>idr_preload — 2 preload for <code class="function">idr_alloc</code> 3 </p></div><div class="refsynopsisdiv"><h2>Synopsis</h2><div class="funcsynopsis"><table border="0" class="funcprototype-table" summary="Function synopsis" style="cellspacing: 0; cellpadding: 0;"><tr><td><code class="funcdef">void <b class="fsfunc">idr_preload </b>(</code></td><td>gfp_t <var class="pdparam">gfp_mask</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="idp1123567132"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>gfp_mask</code></em></span></dt><dd><p> 4 allocation mask to use for preloading 5 </p></dd></dl></div></div><div class="refsect1"><a name="idp1123568764"></a><h2>Description</h2><p> 6 Preload per-cpu layer buffer for <code class="function">idr_alloc</code>. Can only be used from 7 process context and each <code class="function">idr_preload</code> invocation should be matched with 8 <code class="function">idr_preload_end</code>. Note that preemption is disabled while preloaded. 9 </p><p> 10 11 The first <code class="function">idr_alloc</code> in the preloaded section can be treated as if it 12 were invoked with <em class="parameter"><code>gfp_mask</code></em> used for preloading. This allows using more 13 permissive allocation masks for idrs protected by spinlocks. 14 </p><p> 15 16 For example, if <code class="function">idr_alloc</code> below fails, the failure can be treated as 17 if <code class="function">idr_alloc</code> were called with GFP_KERNEL rather than GFP_NOWAIT. 18 </p><p> 19 20 idr_preload(GFP_KERNEL); 21 spin_lock(lock); 22 </p><p> 23 24 id = idr_alloc(idr, ptr, start, end, GFP_NOWAIT); 25 </p><p> 26 27 spin_unlock(lock); 28 <code class="function">idr_preload_end</code>; 29 if (id < 0) 30 error; 31</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="idr.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="idr.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-idr-alloc.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">idr/ida Functions </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> <span class="phrase">idr_alloc</span></td></tr></table></div></body></html> 32