aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl/ctl_tpc.c
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2014-11-24 11:37:27 +0000
committerAlexander Motin <mav@FreeBSD.org>2014-11-24 11:37:27 +0000
commit1251a76b12b7cedbc98f287783f0ad84d68a9464 (patch)
treefd643304ff5efdb3af3186f65019f4b55feeda89 /sys/cam/ctl/ctl_tpc.c
parent9efc7e72bb1daf5d6019871d9c93a1c488a11229 (diff)
downloadsrc-1251a76b12b7cedbc98f287783f0ad84d68a9464.tar.gz
src-1251a76b12b7cedbc98f287783f0ad84d68a9464.zip
Replace home-grown CTL IO allocator with UMA.
Old allocator created significant lock congestion protecting its lists of preallocated I/Os, while UMA provides much better SMP scalability. The downside of UMA is lack of reliable preallocation, that could guarantee successful allocation in non-sleepable environments. But careful code review shown, that only CAM target frontend really has that requirement. Fix that making that frontend preallocate and statically bind CTL I/O for every ATIO/INOT it preallocates any way. That allows to avoid allocations in hot I/O path. Other frontends either may sleep in allocation context or can properly handle allocation errors. On 40-core server with 6 ZVOL-backed LUNs and 7 iSCSI client connections this change increases peak performance from ~700K to >1M IOPS! Yay! :) MFC after: 1 month Sponsored by: iXsystems, Inc.
Notes
Notes: svn path=/head/; revision=274962
Diffstat (limited to 'sys/cam/ctl/ctl_tpc.c')
-rw-r--r--sys/cam/ctl/ctl_tpc.c32
1 files changed, 0 insertions, 32 deletions
diff --git a/sys/cam/ctl/ctl_tpc.c b/sys/cam/ctl/ctl_tpc.c
index 60ae8a01347c..f7648a072ac7 100644
--- a/sys/cam/ctl/ctl_tpc.c
+++ b/sys/cam/ctl/ctl_tpc.c
@@ -812,7 +812,6 @@ tpc_process_b2b(struct tpc_list *list)
uint32_t srcblock, dstblock;
if (list->stage == 1) {
-complete:
while ((tior = TAILQ_FIRST(&list->allio)) != NULL) {
TAILQ_REMOVE(&list->allio, tior, links);
ctl_free_io(tior->io);
@@ -886,10 +885,6 @@ complete:
tior->list = list;
TAILQ_INSERT_TAIL(&list->allio, tior, links);
tior->io = tpcl_alloc_io();
- if (tior->io == NULL) {
- list->error = 1;
- goto complete;
- }
ctl_scsi_read_write(tior->io,
/*data_ptr*/ &list->buf[donebytes],
/*data_len*/ roundbytes,
@@ -909,10 +904,6 @@ complete:
tiow->list = list;
TAILQ_INSERT_TAIL(&list->allio, tiow, links);
tiow->io = tpcl_alloc_io();
- if (tiow->io == NULL) {
- list->error = 1;
- goto complete;
- }
ctl_scsi_read_write(tiow->io,
/*data_ptr*/ &list->buf[donebytes],
/*data_len*/ roundbytes,
@@ -951,7 +942,6 @@ tpc_process_verify(struct tpc_list *list)
uint64_t sl;
if (list->stage == 1) {
-complete:
while ((tio = TAILQ_FIRST(&list->allio)) != NULL) {
TAILQ_REMOVE(&list->allio, tio, links);
ctl_free_io(tio->io);
@@ -990,10 +980,6 @@ complete:
tio->list = list;
TAILQ_INSERT_TAIL(&list->allio, tio, links);
tio->io = tpcl_alloc_io();
- if (tio->io == NULL) {
- list->error = 1;
- goto complete;
- }
ctl_scsi_tur(tio->io, /*tag_type*/ CTL_TAG_SIMPLE, /*control*/ 0);
tio->io->io_hdr.retries = 3;
tio->lun = sl;
@@ -1013,7 +999,6 @@ tpc_process_register_key(struct tpc_list *list)
int datalen;
if (list->stage == 1) {
-complete:
while ((tio = TAILQ_FIRST(&list->allio)) != NULL) {
TAILQ_REMOVE(&list->allio, tio, links);
ctl_free_io(tio->io);
@@ -1050,10 +1035,6 @@ complete:
tio->list = list;
TAILQ_INSERT_TAIL(&list->allio, tio, links);
tio->io = tpcl_alloc_io();
- if (tio->io == NULL) {
- list->error = 1;
- goto complete;
- }
datalen = sizeof(struct scsi_per_res_out_parms);
list->buf = malloc(datalen, M_CTL, M_WAITOK);
ctl_scsi_persistent_res_out(tio->io,
@@ -1112,7 +1093,6 @@ tpc_process_wut(struct tpc_list *list)
uint32_t srcblock, dstblock;
if (list->stage > 0) {
-complete:
/* Cleanup after previous rounds. */
while ((tio = TAILQ_FIRST(&list->allio)) != NULL) {
TAILQ_REMOVE(&list->allio, tio, links);
@@ -1184,10 +1164,6 @@ complete:
tior->list = list;
TAILQ_INSERT_TAIL(&list->allio, tior, links);
tior->io = tpcl_alloc_io();
- if (tior->io == NULL) {
- list->error = 1;
- goto complete;
- }
ctl_scsi_read_write(tior->io,
/*data_ptr*/ &list->buf[donebytes],
/*data_len*/ roundbytes,
@@ -1207,10 +1183,6 @@ complete:
tiow->list = list;
TAILQ_INSERT_TAIL(&list->allio, tiow, links);
tiow->io = tpcl_alloc_io();
- if (tiow->io == NULL) {
- list->error = 1;
- goto complete;
- }
ctl_scsi_read_write(tiow->io,
/*data_ptr*/ &list->buf[donebytes],
/*data_len*/ roundbytes,
@@ -1289,10 +1261,6 @@ complete:
tiow->list = list;
TAILQ_INSERT_TAIL(&list->allio, tiow, links);
tiow->io = tpcl_alloc_io();
- if (tiow->io == NULL) {
- list->error = 1;
- goto complete;
- }
ctl_scsi_write_same(tiow->io,
/*data_ptr*/ list->buf,
/*data_len*/ dstblock,