svn commit: r368104 - stable/12/sys/cam

Alexander Motin mav at FreeBSD.org
Fri Nov 27 13:25:12 UTC 2020


Author: mav
Date: Fri Nov 27 13:25:12 2020
New Revision: 368104
URL: https://svnweb.freebsd.org/changeset/base/368104

Log:
  MFC r367862: Microoptimize cam_num_doneqs math in xpt_done().

Modified:
  stable/12/sys/cam/cam_xpt.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cam/cam_xpt.c
==============================================================================
--- stable/12/sys/cam/cam_xpt.c	Fri Nov 27 11:51:07 2020	(r368103)
+++ stable/12/sys/cam/cam_xpt.c	Fri Nov 27 13:25:12 2020	(r368104)
@@ -179,7 +179,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,
@@ -4671,7 +4671,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