1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968"><title>Locking Between Softirqs</title><meta name="generator" content="DocBook XSL Stylesheets V1.78.1"><link rel="home" href="index.html" title="Unreliable Guide To Locking"><link rel="up" href="locks.html" title="Chapter&#160;3.&#160;Locking in the Linux Kernel"><link rel="prev" href="lock-tasklets.html" title="Locking Between Tasklets/Timers"><link rel="next" href="hardirq-context.html" title="Chapter&#160;4.&#160;Hard IRQ Context"></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">Locking Between Softirqs</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="lock-tasklets.html">Prev</a>&#160;</td><th width="60%" align="center">Chapter&#160;3.&#160;Locking in the Linux Kernel</th><td width="20%" align="right">&#160;<a accesskey="n" href="hardirq-context.html">Next</a></td></tr></table><hr></div><div class="sect1"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="lock-softirqs"></a>Locking Between Softirqs</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="sect2"><a href="lock-softirqs.html#lock-softirqs-same">The Same Softirq</a></span></dt><dt><span class="sect2"><a href="lock-softirqs.html#lock-softirqs-different">Different Softirqs</a></span></dt></dl></div><p>
2      Often a softirq might
3      want to share data with itself or a tasklet/timer.
4    </p><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="lock-softirqs-same"></a>The Same Softirq</h3></div></div></div><p>
5       The same softirq can run on the other CPUs: you can use a
6       per-CPU array (see <a class="xref" href="per-cpu.html" title="Per-CPU Data">the section called &#8220;Per-CPU Data&#8221;</a>) for better
7       performance.  If you're going so far as to use a softirq,
8       you probably care about scalable performance enough
9       to justify the extra complexity.
10     </p><p>
11       You'll need to use <code class="function">spin_lock()</code> and 
12       <code class="function">spin_unlock()</code> for shared data.
13     </p></div><div class="sect2"><div class="titlepage"><div><div><h3 class="title"><a name="lock-softirqs-different"></a>Different Softirqs</h3></div></div></div><p>
14       You'll need to use <code class="function">spin_lock()</code> and
15       <code class="function">spin_unlock()</code> for shared data, whether it
16       be a timer, tasklet, different softirq or the same or another
17       softirq: any of them could be running on a different CPU.
18     </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="lock-tasklets.html">Prev</a>&#160;</td><td width="20%" align="center"><a accesskey="u" href="locks.html">Up</a></td><td width="40%" align="right">&#160;<a accesskey="n" href="hardirq-context.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Locking Between Tasklets/Timers&#160;</td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top">&#160;Chapter&#160;4.&#160;Hard IRQ Context</td></tr></table></div></body></html>
19