1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>rcu_read_lock_held</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Linux Device Drivers"><link rel="up" href="ch01s09.html" title="Kernel utility functions"><link rel="prev" href="API-rcu-unexpedite-gp.html" title="rcu_unexpedite_gp"><link rel="next" href="API-rcu-read-lock-bh-held.html" title="rcu_read_lock_bh_held"></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">rcu_read_lock_held</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-rcu-unexpedite-gp.html">Prev</a>&#160;</td><th width="60%" align="center">Kernel utility functions</th><td width="20%" align="right">&#160;<a accesskey="n" href="API-rcu-read-lock-bh-held.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-rcu-read-lock-held"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>rcu_read_lock_held &#8212; 
2     might we be in RCU read-side critical section?
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">int <b class="fsfunc">rcu_read_lock_held </b>(</code></td><td> <var class="pdparam">void</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer">&#160;</div></div></div><div class="refsect1"><a name="idp1108728516"></a><h2>Arguments</h2><div class="variablelist"><dl class="variablelist"><dt><span class="term"><em class="parameter"><code>void</code></em></span></dt><dd><p>
4     no arguments
5    </p></dd></dl></div></div><div class="refsect1"><a name="idp1108730124"></a><h2>Description</h2><p>
6   </p><p>
7
8   If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an RCU
9   read-side critical section.  In absence of CONFIG_DEBUG_LOCK_ALLOC,
10   this assumes we are in an RCU read-side critical section unless it can
11   prove otherwise.  This is useful for debug checks in functions that
12   require that they be called within an RCU read-side critical section.
13   </p><p>
14
15   Checks <code class="function">debug_lockdep_rcu_enabled</code> to prevent false positives during boot
16   and while lockdep is disabled.
17   </p><p>
18
19   Note that <code class="function">rcu_read_lock</code> and the matching <code class="function">rcu_read_unlock</code> must
20   occur in the same context, for example, it is illegal to invoke
21   <code class="function">rcu_read_unlock</code> in process context if the matching <code class="function">rcu_read_lock</code>
22   was invoked from within an irq handler.
23   </p><p>
24
25   Note that <code class="function">rcu_read_lock</code> is disallowed if the CPU is either idle or
26   offline from an RCU perspective, so check for those as well.
27</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="API-rcu-unexpedite-gp.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="ch01s09.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="API-rcu-read-lock-bh-held.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">rcu_unexpedite_gp</span>&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;<span class="phrase">rcu_read_lock_bh_held</span></td></tr></table></div></body></html>
28