1kstat_queue(9F)          Kernel Functions for Drivers          kstat_queue(9F)
2
3
4

NAME

6       kstat_queue,   kstat_waitq_enter,  kstat_waitq_exit,  kstat_runq_enter,
7       kstat_runq_exit, kstat_waitq_to_runq, kstat_runq_back_to_waitq - update
8       I/O kstat statistics
9

SYNOPSIS

11       #include <sys/types.h>
12       #include <sys/kstat.h>
13
14
15
16       void kstat_waitq_enter(kstat_io_t *kiop);
17
18
19       void kstat_waitq_exit(kstat_io_t *kiop);
20
21
22       void kstat_runq_enter(kstat_io_t *kiop);
23
24
25       void kstat_runq_exit(kstat_io_t *kiop);
26
27
28       void kstat_waitq_to_runq(kstat_io_t *kiop);
29
30
31       void kstat_runq_back_to_waitq(kstat_io_t *kiop);
32
33

INTERFACE LEVEL

35       Solaris DDI specific (Solaris DDI)
36

PARAMETERS

38       kiop     Pointer to a kstat_io(9S) structure.
39
40

DESCRIPTION

42       A  large  number  of I/O subsystems have at least two basic "lists" (or
43       queues) of transactions they manage: one  for  transactions  that  have
44       been accepted for processing but for which processing has yet to begin,
45       and one for transactions which are actively being  processed  (but  not
46       done).  For  this reason, two cumulative time statistics are kept: wait
47       (pre-service) time, and run (service) time.
48
49
50       The kstat_queue() family of functions manage these times based  on  the
51       transitions between the driver wait queue and run queue.
52
53       kstat_waitq_enter()           kstat_waitq_enter() should be called when
54                                     a request arrives and is  placed  into  a
55                                     pre-service  state (such as just prior to
56                                     calling disksort(9F)).
57
58
59       kstat_waitq_exit()            kstat_waitq_exit() should be used when  a
60                                     request  is  removed from its pre-service
61                                     state. (such as just prior to calling the
62                                     driver's start routine).
63
64
65       kstat_runq_enter()            kstat_runq_enter()  is also called when a
66                                     request is placed in  its  service  state
67                                     (just prior to calling the driver's start
68                                     routine, but after kstat_waitq_exit()).
69
70
71       kstat_runq_exit()             kstat_runq_exit() is used when a  request
72                                     is  removed  from its service state (just
73                                     prior to calling biodone(9F)).
74
75
76       kstat_waitq_to_runq()         kstat_waitq_to_runq()    transitions    a
77                                     request  from  the  wait queue to the run
78                                     queue. This is useful wherever the driver
79                                     would     have     normally     done    a
80                                     kstat_waitq_exit() followed by a call  to
81                                     kstat_runq_enter().
82
83
84       kstat_runq_back_to_waitq()    kstat_runq_back_to_waitq()  transitions a
85                                     request from the run queue  back  to  the
86                                     wait queue. This may be necessary in some
87                                     cases (write throttling is an example).
88
89

RETURN VALUES

91       None.
92

CONTEXT

94       kstat_create() can be called from user or kernel context.
95

WARNINGS

97       These transitions must be protected by holding the kstat's ks_lock, and
98       must  be completely accurate (all transitions are recorded). Forgetting
99       a transition may, for example, make an idle disk appear 100% busy.
100

SEE ALSO

102       biodone(9F),    disksort(9F),    kstat_create(9F),    kstat_delete(9F),
103       kstat_named_init(9F), kstat(9S), kstat_io(9S)
104
105
106       Writing Device Drivers
107
108
109
110SunOS 5.11                        4 Apr 1994                   kstat_queue(9F)
Impressum