Date: Tue, 25 Aug 2009 09:18:35 GMT From: Alexander Motin <mav@FreeBSD.org> To: Perforce Change Reviews <perforce@freebsd.org> Subject: PERFORCE change 167772 for review Message-ID: <200908250918.n7P9IZLj027199@repoman.freebsd.org>
next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=167772 Change 167772 by mav@mav_mavbook on 2009/08/25 09:18:25 Avoid extra swi_sched() calls, when several transactions finish at the same time. Affected files ... .. //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#99 edit Differences ... ==== //depot/projects/scottl-camlock/src/sys/cam/cam_xpt.c#99 (text+ko) ==== @@ -4199,12 +4199,12 @@ mtx_lock(&cam_simq_lock); TAILQ_INSERT_TAIL(&cam_simq, sim, links); + mtx_unlock(&cam_simq_lock); sim->flags |= CAM_SIM_ON_DONEQ; - mtx_unlock(&cam_simq_lock); + if ((done_ccb->ccb_h.path->periph->flags & + CAM_PERIPH_POLLED) == 0) + swi_sched(cambio_ih, 0); } - if ((done_ccb->ccb_h.path->periph->flags & - CAM_PERIPH_POLLED) == 0) - swi_sched(cambio_ih, 0); break; default: panic("unknown periph type %d", @@ -4890,16 +4890,20 @@ mtx_lock(&cam_simq_lock); TAILQ_INIT(&queue); - TAILQ_CONCAT(&queue, &cam_simq, links); - mtx_unlock(&cam_simq_lock); + while (!TAILQ_EMPTY(&cam_simq)) { + TAILQ_CONCAT(&queue, &cam_simq, links); + mtx_unlock(&cam_simq_lock); - while ((sim = TAILQ_FIRST(&queue)) != NULL) { - TAILQ_REMOVE(&queue, sim, links); - CAM_SIM_LOCK(sim); - sim->flags &= ~CAM_SIM_ON_DONEQ; - camisr_runqueue(&sim->sim_doneq); - CAM_SIM_UNLOCK(sim); + while ((sim = TAILQ_FIRST(&queue)) != NULL) { + TAILQ_REMOVE(&queue, sim, links); + CAM_SIM_LOCK(sim); + sim->flags &= ~CAM_SIM_ON_DONEQ; + camisr_runqueue(&sim->sim_doneq); + CAM_SIM_UNLOCK(sim); + } + mtx_lock(&cam_simq_lock); } + mtx_unlock(&cam_simq_lock); } static void
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908250918.n7P9IZLj027199>