1*73e9fbd3Syamt.\" $NetBSD: cpu_idle.9,v 1.9 2007/04/20 13:45:43 yamt Exp $ 229f0b10cSyamt.\" 329f0b10cSyamt.\" Copyright (c)2007 YAMAMOTO Takashi, 429f0b10cSyamt.\" All rights reserved. 529f0b10cSyamt.\" 629f0b10cSyamt.\" Redistribution and use in source and binary forms, with or without 729f0b10cSyamt.\" modification, are permitted provided that the following conditions 829f0b10cSyamt.\" are met: 929f0b10cSyamt.\" 1. Redistributions of source code must retain the above copyright 1029f0b10cSyamt.\" notice, this list of conditions and the following disclaimer. 1129f0b10cSyamt.\" 2. Redistributions in binary form must reproduce the above copyright 1229f0b10cSyamt.\" notice, this list of conditions and the following disclaimer in the 1329f0b10cSyamt.\" documentation and/or other materials provided with the distribution. 1429f0b10cSyamt.\" 1529f0b10cSyamt.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 1629f0b10cSyamt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 1729f0b10cSyamt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 1829f0b10cSyamt.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 1929f0b10cSyamt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 2029f0b10cSyamt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 2129f0b10cSyamt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 2229f0b10cSyamt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 2329f0b10cSyamt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 2429f0b10cSyamt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 2529f0b10cSyamt.\" SUCH DAMAGE. 2629f0b10cSyamt.\" 2729f0b10cSyamt.\" ------------------------------------------------------------ 28*73e9fbd3Syamt.Dd April 20, 2007 2929f0b10cSyamt.Dt CPU_IDLE 9 3029f0b10cSyamt.Os 3129f0b10cSyamt.\" ------------------------------------------------------------ 3229f0b10cSyamt.Sh NAME 3329f0b10cSyamt.Nm cpu_idle 3429f0b10cSyamt.Nd machine-dependent processor idling interface 3529f0b10cSyamt.\" ------------------------------------------------------------ 3629f0b10cSyamt.Sh SYNOPSIS 37b2b964eaSyamt.In sys/cpu.h 3829f0b10cSyamt.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 3929f0b10cSyamt.Ft void 4029f0b10cSyamt.Fn cpu_idle \ 4129f0b10cSyamt"void" 4229f0b10cSyamt.\" ------------------------------------------------------------ 4329f0b10cSyamt.Sh DESCRIPTION 4429f0b10cSyamt.Fn cpu_idle 4529f0b10cSyamtis called by machine-independent code when the processor has 4629f0b10cSyamtnothing to do. 4729f0b10cSyamtIt can be used to conserve the processor power, for example. 4829f0b10cSyamt.Pp 4929f0b10cSyamt.Fn cpu_idle 50fbee1fbbSyamtreturns immediately if 51fbee1fbbSyamt.Fn cpu_need_resched 52fbee1fbbSyamthas been called for the processor after 53fbee1fbbSyamtthe last call of 54fbee1fbbSyamt.Fn cpu_idle 55fbee1fbbSyamtor 56*73e9fbd3Syamt.Fn cpu_did_resched 57fbee1fbbSyamton the processor. 58fbee1fbbSyamt.Fn cpu_idle 5929f0b10cSyamtreturns as soon as possible when 6029f0b10cSyamt.Fn cpu_need_resched 6129f0b10cSyamtis called for the processor. 6229f0b10cSyamtOtherwise, it returns whenever it likes. 63fbee1fbbSyamt.Pp 64fbee1fbbSyamt.Fn cpu_idle 65fbee1fbbSyamtis called at 66fbee1fbbSyamt.Dv IPL_NONE , 67fbee1fbbSyamtwithout any locks held. 6829f0b10cSyamt.\" ------------------------------------------------------------ 6929f0b10cSyamt.Sh EXAMPLES 7029f0b10cSyamtThe simplest (and, in some cases, the best) implementation of 7129f0b10cSyamt.Fn cpu_idle 7229f0b10cSyamtis the following. 7329f0b10cSyamt.Bd -literal 7429f0b10cSyamt void 7529f0b10cSyamt cpu_idle(void) 7629f0b10cSyamt { 7729f0b10cSyamt /* nothing */ 7829f0b10cSyamt } 7929f0b10cSyamt.Ed 8029f0b10cSyamt.\" ------------------------------------------------------------ 8129f0b10cSyamt.Sh SEE ALSO 82fbee1fbbSyamt.Xr cpu_need_resched 9 , 83092c56a0Swiz.Xr cpu_switchto 9 , 84092c56a0Swiz.Xr intro 9 , 85fbee1fbbSyamt.Xr spl 9 86