svn commit: r367862 - head/sys/cam

Alexander Motin mav at FreeBSD.org
Fri Nov 20 05:46:28 UTC 2020


Author: mav
Date: Fri Nov 20 05:46:27 2020
New Revision: 367862
URL: https://svnweb.freebsd.org/changeset/base/367862

Log:
  Microoptimize cam_num_doneqs math in xpt_done().
  
  MFC after:	1 week

Modified:
  head/sys/cam/cam_xpt.c

Modified: head/sys/cam/cam_xpt.c
==============================================================================
--- head/sys/cam/cam_xpt.c	Fri Nov 20 03:54:46 2020	(r367861)
+++ head/sys/cam/cam_xpt.c	Fri Nov 20 05:46:27 2020	(r367862)
@@ -178,7 +178,7 @@ struct cam_doneq {
 };
 
 static struct cam_doneq cam_doneqs[MAXCPU];
-static int cam_num_doneqs;
+static u_int __read_mostly cam_num_doneqs;
 static struct proc *cam_proc;
 
 SYSCTL_INT(_kern_cam, OID_AUTO, num_doneqs, CTLFLAG_RDTUN,
@@ -4620,7 +4620,7 @@ xpt_done(union ccb *done_ccb)
 
 	/* Store the time the ccb was in the sim */
 	done_ccb->ccb_h.qos.periph_data = cam_iosched_delta_t(done_ccb->ccb_h.qos.periph_data);
-	hash = (done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id +
+	hash = (u_int)(done_ccb->ccb_h.path_id + done_ccb->ccb_h.target_id +
 	    done_ccb->ccb_h.target_lun) % cam_num_doneqs;
 	queue = &cam_doneqs[hash];
 	mtx_lock(&queue->cam_doneq_mtx);


More information about the svn-src-all mailing list