aboutsummaryrefslogtreecommitdiff
path: root/sys/cam/ctl
diff options
context:
space:
mode:
authorAlexander Motin <mav@FreeBSD.org>2019-03-04 00:49:07 +0000
committerAlexander Motin <mav@FreeBSD.org>2019-03-04 00:49:07 +0000
commit053db1fefd98ad21f063799253501107b0b7552c (patch)
tree4e933fa318db2e82e2df43df5593a92afcc1a3f0 /sys/cam/ctl
parentbe62c88b806af01f6aa8db4ba9871f87825c100c (diff)
downloadsrc-053db1fefd98ad21f063799253501107b0b7552c.tar.gz
src-053db1fefd98ad21f063799253501107b0b7552c.zip
Reduce CTL threads priority to about PUSER.
Since in most configurations CTL serves as network service, we found that this change improves local system interactivity under heavy load. Priority of main threads is set slightly higher then worker taskqueues to make them quickly sort incoming requests not creating bottlenecks, while plenty of worker taskqueues should be less sensitive to latency. MFC after: 1 week Sponsored by: iXsystems, Inc.
Notes
Notes: svn path=/head/; revision=344743
Diffstat (limited to 'sys/cam/ctl')
-rw-r--r--sys/cam/ctl/ctl.c17
-rw-r--r--sys/cam/ctl/ctl_backend_block.c2
-rw-r--r--sys/cam/ctl/ctl_backend_ramdisk.c2
3 files changed, 16 insertions, 5 deletions
diff --git a/sys/cam/ctl/ctl.c b/sys/cam/ctl/ctl.c
index e020c6077968..482e12d0dba8 100644
--- a/sys/cam/ctl/ctl.c
+++ b/sys/cam/ctl/ctl.c
@@ -66,6 +66,8 @@ __FBSDID("$FreeBSD$");
#include <sys/sbuf.h>
#include <sys/smp.h>
#include <sys/endian.h>
+#include <sys/proc.h>
+#include <sys/sched.h>
#include <sys/sysctl.h>
#include <sys/nv.h>
#include <sys/dnv.h>
@@ -13191,6 +13193,9 @@ ctl_work_thread(void *arg)
int retval;
CTL_DEBUG_PRINT(("ctl_work_thread starting\n"));
+ thread_lock(curthread);
+ sched_prio(curthread, PUSER - 1);
+ thread_unlock(curthread);
while (!softc->shutdown) {
/*
@@ -13240,7 +13245,7 @@ ctl_work_thread(void *arg)
}
/* Sleep until we have something to do. */
- mtx_sleep(thr, &thr->queue_lock, PDROP | PRIBIO, "-", 0);
+ mtx_sleep(thr, &thr->queue_lock, PDROP, "-", 0);
}
thr->thread = NULL;
kthread_exit();
@@ -13253,6 +13258,9 @@ ctl_lun_thread(void *arg)
struct ctl_be_lun *be_lun;
CTL_DEBUG_PRINT(("ctl_lun_thread starting\n"));
+ thread_lock(curthread);
+ sched_prio(curthread, PUSER - 1);
+ thread_unlock(curthread);
while (!softc->shutdown) {
mtx_lock(&softc->ctl_lock);
@@ -13266,7 +13274,7 @@ ctl_lun_thread(void *arg)
/* Sleep until we have something to do. */
mtx_sleep(&softc->pending_lun_queue, &softc->ctl_lock,
- PDROP | PRIBIO, "-", 0);
+ PDROP, "-", 0);
}
softc->lun_thread = NULL;
kthread_exit();
@@ -13284,6 +13292,9 @@ ctl_thresh_thread(void *arg)
int i, e, set;
CTL_DEBUG_PRINT(("ctl_thresh_thread starting\n"));
+ thread_lock(curthread);
+ sched_prio(curthread, PUSER - 1);
+ thread_unlock(curthread);
while (!softc->shutdown) {
mtx_lock(&softc->ctl_lock);
@@ -13371,7 +13382,7 @@ ctl_thresh_thread(void *arg)
}
}
mtx_sleep(&softc->thresh_thread, &softc->ctl_lock,
- PDROP | PRIBIO, "-", CTL_LBP_PERIOD * hz);
+ PDROP, "-", CTL_LBP_PERIOD * hz);
}
softc->thresh_thread = NULL;
kthread_exit();
diff --git a/sys/cam/ctl/ctl_backend_block.c b/sys/cam/ctl/ctl_backend_block.c
index a0cb085e0ca2..cbe25c07f14c 100644
--- a/sys/cam/ctl/ctl_backend_block.c
+++ b/sys/cam/ctl/ctl_backend_block.c
@@ -2381,7 +2381,7 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, struct ctl_lun_req *req)
*/
retval = taskqueue_start_threads(&be_lun->io_taskqueue,
/*num threads*/num_threads,
- /*priority*/PWAIT,
+ /*priority*/PUSER,
/*thread name*/
"%s taskq", be_lun->lunname);
diff --git a/sys/cam/ctl/ctl_backend_ramdisk.c b/sys/cam/ctl/ctl_backend_ramdisk.c
index e7ac5ec53f69..e3e0df11925b 100644
--- a/sys/cam/ctl/ctl_backend_ramdisk.c
+++ b/sys/cam/ctl/ctl_backend_ramdisk.c
@@ -1149,7 +1149,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_softc *softc,
retval = taskqueue_start_threads(&be_lun->io_taskqueue,
/*num threads*/1,
- /*priority*/PWAIT,
+ /*priority*/PUSER,
/*thread name*/
"%s taskq", be_lun->lunname);
if (retval != 0)