xref: /netbsd-src/share/man/man9/cpu_idle.9 (revision 73e9fbd3df9c5c6c16ae691074ed619a7147ff04)
1.\"	$NetBSD: cpu_idle.9,v 1.9 2007/04/20 13:45:43 yamt Exp $
2.\"
3.\" Copyright (c)2007 YAMAMOTO Takashi,
4.\" All rights reserved.
5.\"
6.\" Redistribution and use in source and binary forms, with or without
7.\" modification, are permitted provided that the following conditions
8.\" are met:
9.\" 1. Redistributions of source code must retain the above copyright
10.\"    notice, this list of conditions and the following disclaimer.
11.\" 2. Redistributions in binary form must reproduce the above copyright
12.\"    notice, this list of conditions and the following disclaimer in the
13.\"    documentation and/or other materials provided with the distribution.
14.\"
15.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
19.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
25.\" SUCH DAMAGE.
26.\"
27.\" ------------------------------------------------------------
28.Dd April 20, 2007
29.Dt CPU_IDLE 9
30.Os
31.\" ------------------------------------------------------------
32.Sh NAME
33.Nm cpu_idle
34.Nd machine-dependent processor idling interface
35.\" ------------------------------------------------------------
36.Sh SYNOPSIS
37.In sys/cpu.h
38.\" - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
39.Ft void
40.Fn cpu_idle \
41"void"
42.\" ------------------------------------------------------------
43.Sh DESCRIPTION
44.Fn cpu_idle
45is called by machine-independent code when the processor has
46nothing to do.
47It can be used to conserve the processor power, for example.
48.Pp
49.Fn cpu_idle
50returns immediately if
51.Fn cpu_need_resched
52has been called for the processor after
53the last call of
54.Fn cpu_idle
55or
56.Fn cpu_did_resched
57on the processor.
58.Fn cpu_idle
59returns as soon as possible when
60.Fn cpu_need_resched
61is called for the processor.
62Otherwise, it returns whenever it likes.
63.Pp
64.Fn cpu_idle
65is called at
66.Dv IPL_NONE ,
67without any locks held.
68.\" ------------------------------------------------------------
69.Sh EXAMPLES
70The simplest (and, in some cases, the best) implementation of
71.Fn cpu_idle
72is the following.
73.Bd -literal
74	void
75	cpu_idle(void)
76	{
77		/* nothing */
78	}
79.Ed
80.\" ------------------------------------------------------------
81.Sh SEE ALSO
82.Xr cpu_need_resched 9 ,
83.Xr cpu_switchto 9 ,
84.Xr intro 9 ,
85.Xr spl 9
86