<?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>Locks and Uniprocessor Kernels</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="ch03.html" title="Chapter 3. Locking in the Linux Kernel" /><link rel="next" href="ch03s03.html" title="Locking Only In User Context" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Locks and Uniprocessor Kernels</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ch03.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="ch03s03.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="Locks and Uniprocessor Kernels"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="uniprocessor"></a>Locks and Uniprocessor Kernels</h2></div></div></div><p> For kernels compiled without <span class="symbol">CONFIG_SMP</span>, and without <span class="symbol">CONFIG_PREEMPT</span> spinlocks do not exist at all. This is an excellent design decision: when no-one else can run at the same time, there is no reason to have a lock. </p><p> If the kernel is compiled without <span class="symbol">CONFIG_SMP</span>, but <span class="symbol">CONFIG_PREEMPT</span> is set, then spinlocks simply disable preemption, which is sufficient to prevent any races. For most purposes, we can think of preemption as equivalent to SMP, and not worry about it separately. </p><p> You should always test your locking code with <span class="symbol">CONFIG_SMP</span> and <span class="symbol">CONFIG_PREEMPT</span> enabled, even if you don't have an SMP test box, because it will still catch some kinds of locking bugs. </p><p> Mutexes still exist, because they are required for synchronization between <a class="firstterm" href="go01.html#gloss-usercontext"><em class="firstterm">user contexts</em></a>, as we will see below. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ch03.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="ch03s03.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 3. Locking in the Linux Kernel </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Locking Only In User Context</td></tr></table></div></body></html>