Changeset View
Changeset View
Standalone View
Standalone View
sys/cam/cam_iosched.c
Show First 20 Lines • Show All 133 Lines • ▼ Show 20 Lines | |||||
#ifndef LAT_BUCKETS | #ifndef LAT_BUCKETS | ||||
#define LAT_BUCKETS 20 /* < 20us < 40us ... < 2^(n-1)*20us >= 2^(n-1)*20us */ | #define LAT_BUCKETS 20 /* < 20us < 40us ... < 2^(n-1)*20us >= 2^(n-1)*20us */ | ||||
#endif | #endif | ||||
static int lat_buckets = LAT_BUCKETS; | static int lat_buckets = LAT_BUCKETS; | ||||
SYSCTL_INT(_kern_cam_iosched, OID_AUTO, buckets, CTLFLAG_RD, | SYSCTL_INT(_kern_cam_iosched, OID_AUTO, buckets, CTLFLAG_RD, | ||||
&lat_buckets, LAT_BUCKETS, | &lat_buckets, LAT_BUCKETS, | ||||
"Total number of latency buckets published"); | "Total number of latency buckets published"); | ||||
/* | |||||
* Read bias: how many reads do we favor before scheduling a write | |||||
* when we have a choice. | |||||
*/ | |||||
static int default_read_bias = 0; | |||||
SYSCTL_INT(_kern_cam_iosched, OID_AUTO, read_bias, CTLFLAG_RWTUN, | |||||
&default_read_bias, 0, | |||||
"Default read bias for new devices."); | |||||
struct iop_stats; | struct iop_stats; | ||||
struct cam_iosched_softc; | struct cam_iosched_softc; | ||||
int iosched_debug = 0; | int iosched_debug = 0; | ||||
typedef enum { | typedef enum { | ||||
none = 0, /* No limits */ | none = 0, /* No limits */ | ||||
queue_depth, /* Limit how many ops we queue to SIM */ | queue_depth, /* Limit how many ops we queue to SIM */ | ||||
▲ Show 20 Lines • Show All 994 Lines • ▼ Show 20 Lines | if (iosched_debug) | ||||
printf("CAM IOSCHEDULER Allocating entry at %p\n", *iscp); | printf("CAM IOSCHEDULER Allocating entry at %p\n", *iscp); | ||||
#endif | #endif | ||||
(*iscp)->sort_io_queue = -1; | (*iscp)->sort_io_queue = -1; | ||||
bioq_init(&(*iscp)->bio_queue); | bioq_init(&(*iscp)->bio_queue); | ||||
bioq_init(&(*iscp)->trim_queue); | bioq_init(&(*iscp)->trim_queue); | ||||
#ifdef CAM_IOSCHED_DYNAMIC | #ifdef CAM_IOSCHED_DYNAMIC | ||||
if (do_dynamic_iosched) { | if (do_dynamic_iosched) { | ||||
bioq_init(&(*iscp)->write_queue); | bioq_init(&(*iscp)->write_queue); | ||||
(*iscp)->read_bias = 0; | (*iscp)->read_bias = default_read_bias; | ||||
(*iscp)->current_read_bias = 0; | (*iscp)->current_read_bias = 0; | ||||
(*iscp)->quanta = min(hz, 200); | (*iscp)->quanta = min(hz, 200); | ||||
cam_iosched_iop_stats_init(*iscp, &(*iscp)->read_stats); | cam_iosched_iop_stats_init(*iscp, &(*iscp)->read_stats); | ||||
cam_iosched_iop_stats_init(*iscp, &(*iscp)->write_stats); | cam_iosched_iop_stats_init(*iscp, &(*iscp)->write_stats); | ||||
cam_iosched_iop_stats_init(*iscp, &(*iscp)->trim_stats); | cam_iosched_iop_stats_init(*iscp, &(*iscp)->trim_stats); | ||||
(*iscp)->trim_stats.max = 1; /* Trims are special: one at a time for now */ | (*iscp)->trim_stats.max = 1; /* Trims are special: one at a time for now */ | ||||
(*iscp)->last_time = sbinuptime(); | (*iscp)->last_time = sbinuptime(); | ||||
callout_init_mtx(&(*iscp)->ticker, cam_periph_mtx(periph), 0); | callout_init_mtx(&(*iscp)->ticker, cam_periph_mtx(periph), 0); | ||||
▲ Show 20 Lines • Show All 68 Lines • ▼ Show 20 Lines | #ifdef CAM_IOSCHED_DYNAMIC | ||||
cam_iosched_iop_stats_sysctl_init(isc, &isc->read_stats, "read"); | cam_iosched_iop_stats_sysctl_init(isc, &isc->read_stats, "read"); | ||||
cam_iosched_iop_stats_sysctl_init(isc, &isc->write_stats, "write"); | cam_iosched_iop_stats_sysctl_init(isc, &isc->write_stats, "write"); | ||||
cam_iosched_iop_stats_sysctl_init(isc, &isc->trim_stats, "trim"); | cam_iosched_iop_stats_sysctl_init(isc, &isc->trim_stats, "trim"); | ||||
cam_iosched_cl_sysctl_init(isc); | cam_iosched_cl_sysctl_init(isc); | ||||
SYSCTL_ADD_INT(ctx, n, | SYSCTL_ADD_INT(ctx, n, | ||||
OID_AUTO, "read_bias", CTLFLAG_RW, | OID_AUTO, "read_bias", CTLFLAG_RW, | ||||
&isc->read_bias, 0, | &isc->read_bias, default_read_bias, | ||||
chs: this "val" parameter isn't used if the "ptr" parameter immediate before it is non-NULL, so you… | |||||
"How biased towards read should we be independent of limits"); | "How biased towards read should we be independent of limits"); | ||||
SYSCTL_ADD_PROC(ctx, n, | SYSCTL_ADD_PROC(ctx, n, | ||||
OID_AUTO, "quanta", CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, | OID_AUTO, "quanta", CTLTYPE_UINT | CTLFLAG_RW | CTLFLAG_MPSAFE, | ||||
&isc->quanta, 0, cam_iosched_quanta_sysctl, "I", | &isc->quanta, 0, cam_iosched_quanta_sysctl, "I", | ||||
"How many quanta per second do we slice the I/O up into"); | "How many quanta per second do we slice the I/O up into"); | ||||
SYSCTL_ADD_INT(ctx, n, | SYSCTL_ADD_INT(ctx, n, | ||||
▲ Show 20 Lines • Show All 817 Lines • Show Last 20 Lines |
this "val" parameter isn't used if the "ptr" parameter immediate before it is non-NULL, so you might as well just leave val 0 here.