From d62e367bbb1570c7115057ecdf4d6bb7565bdf58 Mon Sep 17 00:00:00 2001 From: Magliano Andrea Date: Wed, 15 Jun 2011 19:01:34 +0200 Subject: [PATCH 1/2] Optimize isr routine (from FreeBSD), proved to work --- sys/bus/cam/cam_xpt.c | 23 ++++++++++++++--------- 1 files changed, 14 insertions(+), 9 deletions(-) diff --git a/sys/bus/cam/cam_xpt.c b/sys/bus/cam/cam_xpt.c index 92b4e37..f62f51f 100644 --- a/sys/bus/cam/cam_xpt.c +++ b/sys/bus/cam/cam_xpt.c @@ -7234,16 +7234,21 @@ camisr(void *dummy) spin_lock(&cam_simq_spin); TAILQ_INIT(&queue); - TAILQ_CONCAT(&queue, &cam_simq, links); - spin_unlock(&cam_simq_spin); - while ((sim = TAILQ_FIRST(&queue)) != NULL) { - TAILQ_REMOVE(&queue, sim, links); - CAM_SIM_LOCK(sim); - sim->flags &= ~CAM_SIM_ON_DONEQ; - camisr_runqueue(sim); - CAM_SIM_UNLOCK(sim); - } + while (!TAILQ_EMPTY(&cam_simq)) { + TAILQ_CONCAT(&queue, &cam_simq, links); + spin_unlock(&cam_simq_spin); + + while ((sim = TAILQ_FIRST(&queue)) != NULL) { + TAILQ_REMOVE(&queue, sim, links); + CAM_SIM_LOCK(sim); + sim->flags &= ~CAM_SIM_ON_DONEQ; + camisr_runqueue(sim); + CAM_SIM_UNLOCK(sim); + } + spin_lock(&cam_simq_spin); + } + spin_unlock(&cam_simq_spin); } static void -- 1.7.4.1