summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormav <mav@FreeBSD.org>2009-09-06 18:40:48 +0000
committermav <mav@FreeBSD.org>2009-09-06 18:40:48 +0000
commit3672dfaf9fabe068797a5a54c19749c017412027 (patch)
tree79937f7c09d179d05baaa067158e0aa8e49db72c
parentfe152cceaff5c45acd2712a5451f81769eb32dff (diff)
downloadFreeBSD-src-3672dfaf9fabe068797a5a54c19749c017412027.zip
FreeBSD-src-3672dfaf9fabe068797a5a54c19749c017412027.tar.gz
Avoid extra swi_sched() call, if this SIM is already queued.
It reduces overhead for coalesced command completions.
-rw-r--r--sys/cam/cam_xpt.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/sys/cam/cam_xpt.c b/sys/cam/cam_xpt.c
index 1c2f614..b29295d 100644
--- a/sys/cam/cam_xpt.c
+++ b/sys/cam/cam_xpt.c
@@ -4198,12 +4198,12 @@ xpt_done(union ccb *done_ccb)
mtx_lock(&cam_simq_lock);
TAILQ_INSERT_TAIL(&cam_simq, sim,
links);
- sim->flags |= CAM_SIM_ON_DONEQ;
mtx_unlock(&cam_simq_lock);
+ sim->flags |= CAM_SIM_ON_DONEQ;
+ 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",
@@ -4889,16 +4889,20 @@ camisr(void *dummy)
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
OpenPOWER on IntegriCloud