1<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>rcu_read_lock_sched_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-barrier.html" title="rcu_barrier"><link rel="next" href="API-rcu-expedite-gp.html" title="rcu_expedite_gp"></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_sched_held</span></th></tr><tr><td width="20%" align="left"><a accesskey="p" href="API-rcu-barrier.html">Prev</a> </td><th width="60%" align="center">Kernel utility functions</th><td width="20%" align="right"> <a accesskey="n" href="API-rcu-expedite-gp.html">Next</a></td></tr></table><hr></div><div class="refentry"><a name="API-rcu-read-lock-sched-held"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>rcu_read_lock_sched_held — 2 might we be in RCU-sched 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_sched_held </b>(</code></td><td> <var class="pdparam">void</var><code>)</code>;</td></tr></table><div class="funcprototype-spacer"> </div></div></div><div class="refsect1"><a name="id-1.3.10.51.5"></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="id-1.3.10.51.6"></a><h2>Description</h2><p> 6 </p><p> 7 8 If CONFIG_DEBUG_LOCK_ALLOC is selected, returns nonzero iff in an 9 RCU-sched read-side critical section. In absence of 10 CONFIG_DEBUG_LOCK_ALLOC, this assumes we are in an RCU-sched read-side 11 critical section unless it can prove otherwise. Note that disabling 12 of preemption (including disabling irqs) counts as an RCU-sched 13 read-side critical section. This is useful for debug checks in functions 14 that required that they be called within an RCU-sched read-side 15 critical section. 16 </p><p> 17 18 Check <code class="function">debug_lockdep_rcu_enabled</code> to prevent false positives during boot 19 and while lockdep is disabled. 20 </p><p> 21 22 Note that if the CPU is in the idle loop from an RCU point of 23 view (ie: that we are in the section between <code class="function"><a class="link" href="API-rcu-idle-enter.html" title="rcu_idle_enter">rcu_idle_enter</a></code> and 24 <code class="function"><a class="link" href="API-rcu-idle-exit.html" title="rcu_idle_exit">rcu_idle_exit</a></code>) then <code class="function"><a class="link" href="API-rcu-read-lock-held.html" title="rcu_read_lock_held">rcu_read_lock_held</a></code> returns false even if the CPU 25 did an <code class="function">rcu_read_lock</code>. The reason for this is that RCU ignores CPUs 26 that are in such a section, considering these as in extended quiescent 27 state, so such a CPU is effectively never in an RCU read-side critical 28 section regardless of what RCU primitives it invokes. This state of 29 affairs is required --- we need to keep an RCU-free window in idle 30 where the CPU may possibly enter into low power mode. This way we can 31 notice an extended quiescent state to other CPUs that started a grace 32 period. Otherwise we would delay any grace period as long as we run in 33 the idle task. 34 </p><p> 35 36 Similarly, we avoid claiming an SRCU read lock held if the current 37 CPU is offline. 38</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-barrier.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch01s09.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="API-rcu-expedite-gp.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span class="phrase">rcu_barrier</span> </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">rcu_expedite_gp</span></td></tr></table></div></body></html> 39