summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormk <mk@openbsd.org>2010-06-28 18:40:51 +0000
committermk <mk@openbsd.org>2010-06-28 18:40:51 +0000
commit8a58b287b1a73c2d678d9005e2b31412d13a5193 (patch)
tree441cce8b421a13335c8069e851546b411c7e892e
parentRemove all adapter-specific 'struct scsi_device's. They are never used. First (diff)
downloadwireguard-openbsd-8a58b287b1a73c2d678d9005e2b31412d13a5193.tar.xz
wireguard-openbsd-8a58b287b1a73c2d678d9005e2b31412d13a5193.zip
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
-rw-r--r--sys/dev/pci/arc.c14
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);
}