diff options
author | Michael Knudsen <mk@cvs.openbsd.org> | 2010-06-28 18:40:52 +0000 |
---|---|---|
committer | Michael Knudsen <mk@cvs.openbsd.org> | 2010-06-28 18:40:52 +0000 |
commit | f668ba96c8a5c3248f9ce4db53f92c7ef8e16f9c (patch) | |
tree | 4764c84f3f390379127315563845a80b9527870e /sys/dev | |
parent | 32d204697861b907520e94f82e392d3e7d6d661a (diff) |
Use an SLIST instead of a TAILQ for the ccb free list. Order doesn't
matter, an SLIST is smaller, and the first element is more likely to be
in cache. Previously we took from the head and returned to the tail,
which meant that we were using the ccb that was the least recently used
one which also means it has the smallest chance of being in cache.
ok deraadt
Diffstat (limited to 'sys/dev')
-rw-r--r-- | sys/dev/pci/arc.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/sys/dev/pci/arc.c b/sys/dev/pci/arc.c index e192f5b2b95..d600be8d7b8 100644 --- a/sys/dev/pci/arc.c +++ b/sys/dev/pci/arc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: arc.c,v 1.85 2010/06/28 18:31:02 krw Exp $ */ +/* $OpenBSD: arc.c,v 1.86 2010/06/28 18:40:51 mk Exp $ */ /* * Copyright (c) 2006 David Gwynne <dlg@openbsd.org> @@ -351,7 +351,7 @@ int arc_intr(void *); struct arc_iop; struct arc_ccb; -TAILQ_HEAD(arc_ccb_list, arc_ccb); +SLIST_HEAD(arc_ccb_list, arc_ccb); struct arc_softc { struct device sc_dev; @@ -448,7 +448,7 @@ struct arc_ccb { struct arc_io_cmd *ccb_cmd; u_int32_t ccb_cmd_post; - TAILQ_ENTRY(arc_ccb) ccb_link; + SLIST_ENTRY(arc_ccb) ccb_link; }; int arc_alloc_ccbs(struct arc_softc *); @@ -1899,7 +1899,7 @@ arc_alloc_ccbs(struct arc_softc *sc) u_int8_t *cmd; int i; - TAILQ_INIT(&sc->sc_ccb_free); + SLIST_INIT(&sc->sc_ccb_free); sc->sc_ccbs = malloc(sizeof(struct arc_ccb) * sc->sc_req_count, M_DEVBUF, M_WAITOK | M_ZERO); @@ -1951,9 +1951,9 @@ arc_get_ccb(struct arc_softc *sc) { struct arc_ccb *ccb; - ccb = TAILQ_FIRST(&sc->sc_ccb_free); + ccb = SLIST_FIRST(&sc->sc_ccb_free); if (ccb != NULL) - TAILQ_REMOVE(&sc->sc_ccb_free, ccb, ccb_link); + SLIST_REMOVE_HEAD(&sc->sc_ccb_free, ccb_link); return (ccb); } @@ -1963,5 +1963,5 @@ arc_put_ccb(struct arc_softc *sc, struct arc_ccb *ccb) { ccb->ccb_xs = NULL; bzero(ccb->ccb_cmd, ARC_MAX_IOCMDLEN); - TAILQ_INSERT_TAIL(&sc->sc_ccb_free, ccb, ccb_link); + SLIST_INSERT_HEAD(&sc->sc_ccb_free, ccb, ccb_link); } |