Go to main content

man pages section 9: DDI and DKI Kernel Functions

Exit Print View

Updated: Thursday, June 13, 2019

kstat2_runq_back_to_waitq (9F)


kstat2_runq_enter, kstat2_waitq_enter, kstat2_waitq_exit, kstat2_runq_exit, kstat2_waitq_to_runq, kstat2_runq_back_to_waitq - update I/O kstat statistics


#include <sys/types.h>
#include <sys/kstat2.h>

void kstat2_waitq_enter(kstat2_io_t *kiop);

void kstat2_waitq_exit(kstat2_io_t *kiop);

void kstat2_runq_enter(kstat2_io_t *kiop);

void kstat2_runq_exit(kstat2_io_t *kiop);

void kstat2_waitq_to_runq(kstat2_io_t *kiop);

void kstat2_runq_back_to_waitq(kstat2_io_t *kiop);

Interface Level

Solaris DDI specific (Solaris DDI)



Pointer to a kstat2_io(9S) structure.


A large number of I/O subsystems have at least two basic lists (or queues) of transactions they manage: one for transactions that are accepted for processing but the processing is yet to begin, and one for transactions that are actively being processed but not completed. For this reason, two cumulative time statistics are kept: wait (pre-service) time, and run (service) time.

The kstat2 queue family of functions manage the time based on the transitions between the driver wait queue and run queue.


The kstat2_waitq_enter() function is called when a request arrives and is placed into a pre-service state (such as just prior to calling disksort(9F)).


The kstat2_waitq_exit() function is used when a request is removed from its pre-service state. (such as just prior to calling the driver's start routine).


The kstat2_runq_enter() function is also called when a request is placed in its service state (just prior to calling the driver's start routine, but after kstat2_waitq_exit() function).


The kstat2_runq_exit() function is used when a request is removed from its service state (just prior to calling biodone(9F)).


The kstat2_waitq_to_runq() function is used to transition a request from the wait queue to the run queue. This is useful wherever the driver would have normally done a kstat2_waitq_exit() followed by a call to kstat2_runq_enter().


The kstat2_runq_back_to_waitq() function is used to transition a request from the run queue back to the wait queue. This may be necessary in some cases (write throttling is an example).

Return Values



These functions can be called from user or kernel context.

See Also

biodone(9F), disksort(9F), kstat2_create(9F), kstat2_hold_bykid(9F), kstat2_nv_init(9F), kstat2(9S), kstat2_io(9S)


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