Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 11 Mar 2019 13:56:51 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r345007 - stable/11/sys/cam/ctl
Message-ID:  <201903111356.x2BDupJh088116@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Mon Mar 11 13:56:51 2019
New Revision: 345007
URL: https://svnweb.freebsd.org/changeset/base/345007

Log:
  MFC r344743: 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.

Modified:
  stable/11/sys/cam/ctl/ctl.c
  stable/11/sys/cam/ctl/ctl_backend_block.c
  stable/11/sys/cam/ctl/ctl_backend_ramdisk.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/cam/ctl/ctl.c
==============================================================================
--- stable/11/sys/cam/ctl/ctl.c	Mon Mar 11 13:55:47 2019	(r345006)
+++ stable/11/sys/cam/ctl/ctl.c	Mon Mar 11 13:56:51 2019	(r345007)
@@ -62,6 +62,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 <vm/uma.h>
 
@@ -13343,6 +13345,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) {
 		/*
@@ -13392,7 +13397,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();
@@ -13405,6 +13410,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);
@@ -13418,7 +13426,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();
@@ -13436,6 +13444,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);
@@ -13523,7 +13534,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();

Modified: stable/11/sys/cam/ctl/ctl_backend_block.c
==============================================================================
--- stable/11/sys/cam/ctl/ctl_backend_block.c	Mon Mar 11 13:55:47 2019	(r345006)
+++ stable/11/sys/cam/ctl/ctl_backend_block.c	Mon Mar 11 13:56:51 2019	(r345007)
@@ -2378,7 +2378,7 @@ ctl_be_block_create(struct ctl_be_block_softc *softc, 
 	 */
 	retval = taskqueue_start_threads(&be_lun->io_taskqueue,
 					 /*num threads*/num_threads,
-					 /*priority*/PWAIT,
+					 /*priority*/PUSER,
 					 /*thread name*/
 					 "%s taskq", be_lun->lunname);
 

Modified: stable/11/sys/cam/ctl/ctl_backend_ramdisk.c
==============================================================================
--- stable/11/sys/cam/ctl/ctl_backend_ramdisk.c	Mon Mar 11 13:55:47 2019	(r345006)
+++ stable/11/sys/cam/ctl/ctl_backend_ramdisk.c	Mon Mar 11 13:56:51 2019	(r345007)
@@ -1145,7 +1145,7 @@ ctl_backend_ramdisk_create(struct ctl_be_ramdisk_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)



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201903111356.x2BDupJh088116>