<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>Locking Between Tasklets/Timers</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Unreliable Guide To Locking" /><link rel="up" href="ch03.html" title="Chapter 3. Locking in the Linux Kernel" /><link rel="prev" href="ch03s06.html" title="Locking Between User Context and Timers" /><link rel="next" href="ch03s08.html" title="Locking Between Softirqs" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Locking Between Tasklets/Timers</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03s06.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Locking in the Linux Kernel</th><td width="20%" align="right"> <a accesskey="n" href="ch03s08.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="Locking Between Tasklets/Timers"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="lock-tasklets"></a>Locking Between Tasklets/Timers</h2></div></div></div><div class="toc"><dl><dt><span class="sect2"><a href="ch03s07.html#lock-tasklets-same">The Same Tasklet/Timer</a></span></dt><dt><span class="sect2"><a href="ch03s07.html#lock-tasklets-different">Different Tasklets/Timers</a></span></dt></dl></div><p> Sometimes a tasklet or timer might want to share data with another tasklet or timer. </p><div class="sect2" title="The Same Tasklet/Timer"><div class="titlepage"><div><div><h3 class="title"><a id="lock-tasklets-same"></a>The Same Tasklet/Timer</h3></div></div></div><p> Since a tasklet is never run on two CPUs at once, you don't need to worry about your tasklet being reentrant (running twice at once), even on SMP. </p></div><div class="sect2" title="Different Tasklets/Timers"><div class="titlepage"><div><div><h3 class="title"><a id="lock-tasklets-different"></a>Different Tasklets/Timers</h3></div></div></div><p> If another tasklet/timer wants to share data with your tasklet or timer , you will both need to use <code class="function">spin_lock()</code> and <code class="function">spin_unlock()</code> calls. <code class="function">spin_lock_bh()</code> is unnecessary here, as you are already in a tasklet, and none will be run on the same CPU. </p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03s06.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s08.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Locking Between User Context and Timers </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Locking Between Softirqs</td></tr></table></div></body></html>