path: root/sys/cam/ctl/ctl_frontend_ioctl.c
diff options
authorAlexander Motin <mav@FreeBSD.org>2019-02-27 21:29:21 +0000
committerAlexander Motin <mav@FreeBSD.org>2019-02-27 21:29:21 +0000
commit321f819ba54695178e5e9c20b268019748475ec7 (patch)
tree1f153466285952e991ed41a0a9e8c32bcad423a7 /sys/cam/ctl/ctl_frontend_ioctl.c
parentdec9dcabf8fc669f6da3bfd03ab943d67e01e787 (diff)
Refactor command ordering/blocking mechanism in CTL.
Replace long per-LUN queue of blocked commands, scanned on each command completion and sometimes even twice, causing up to O(n^^2) processing cost, by much shorter per-command blocked queues, scanned only when respective command completes, and check only commands before the previous blocker, reducing cost to O(n). While there, unblock aborted commands to make them "complete" ASAP to be removed from the OOA queue and so not waste time ordering other commands against them. Aborted commands that were not sent to execution yet should have no visible side effects, so this is safe and easy optimization now, comparing to commands already in processing, which are a still pain. Together those two optimizations should fix quite pathological case, when due to backend slowness CTL accumulated many thousands of blocked requests, partially aborted by initiator and so supposedly not even existing, but still wasting CTL CPU time. MFC after: 2 weeks Sponsored by: iXsystems, Inc.
Notes: svn path=/head/; revision=344636
Diffstat (limited to 'sys/cam/ctl/ctl_frontend_ioctl.c')
1 files changed, 1 insertions, 0 deletions
diff --git a/sys/cam/ctl/ctl_frontend_ioctl.c b/sys/cam/ctl/ctl_frontend_ioctl.c
index 221d912714b7..24c624cc38d2 100644
--- a/sys/cam/ctl/ctl_frontend_ioctl.c
+++ b/sys/cam/ctl/ctl_frontend_ioctl.c
@@ -620,6 +620,7 @@ ctl_ioctl_io(struct cdev *dev, u_long cmd, caddr_t addr, int flag,
memcpy(io, (void *)addr, sizeof(*io));
io->io_hdr.pool = pool_tmp;
CTL_SOFTC(io) = sc_tmp;
+ TAILQ_INIT(&io->io_hdr.blocked_queue);
* No status yet, so make sure the status is set properly.