NetBSD/share/man/man9/cpu_idle.9

86 lines
2.8 KiB
Groff
Raw Normal View History

2007-04-20 17:45:43 +04:00
.\" $NetBSD: cpu_idle.9,v 1.9 2007/04/20 13:45:43 yamt Exp $
.\"
.\" Copyright (c)2007 YAMAMOTO Takashi,
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" ------------------------------------------------------------
2007-04-20 17:45:43 +04:00
.Dd April 20, 2007
.Dt CPU_IDLE 9
.Os
.\" ------------------------------------------------------------
.Sh NAME
.Nm cpu_idle
.Nd machine-dependent processor idling interface
.\" ------------------------------------------------------------
.Sh SYNOPSIS
2007-02-23 18:59:17 +03:00
.In sys/cpu.h
.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
.Ft void
.Fn cpu_idle \
"void"
.\" ------------------------------------------------------------
.Sh DESCRIPTION
.Fn cpu_idle
is called by machine-independent code when the processor has
nothing to do.
It can be used to conserve the processor power, for example.
.Pp
.Fn cpu_idle
2007-02-17 20:14:21 +03:00
returns immediately if
.Fn cpu_need_resched
has been called for the processor after
the last call of
.Fn cpu_idle
or
2007-04-20 17:45:43 +04:00
.Fn cpu_did_resched
2007-02-17 20:14:21 +03:00
on the processor.
.Fn cpu_idle
returns as soon as possible when
.Fn cpu_need_resched
is called for the processor.
Otherwise, it returns whenever it likes.
2007-02-17 20:14:21 +03:00
.Pp
.Fn cpu_idle
is called at
.Dv IPL_NONE ,
without any locks held.
.\" ------------------------------------------------------------
.Sh EXAMPLES
The simplest (and, in some cases, the best) implementation of
.Fn cpu_idle
is the following.
.Bd -literal
void
cpu_idle(void)
{
/* nothing */
}
.Ed
.\" ------------------------------------------------------------
.Sh SEE ALSO
2007-02-17 20:14:21 +03:00
.Xr cpu_need_resched 9 ,
2007-02-20 11:18:03 +03:00
.Xr cpu_switchto 9 ,
.Xr intro 9 ,
2007-02-17 20:14:21 +03:00
.Xr spl 9