From: Matthew Dillon Date: Tue, 10 Jun 2008 17:20:52 +0000 (+0000) Subject: Switch from bioq_insert_tail() to bioqdisksort(). When the kernel is X-Git-Tag: v2.0.1~433 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/ec1b64f8ce85db74019d53368dbec249eab4035f Switch from bioq_insert_tail() to bioqdisksort(). When the kernel is juggling hundreds of I/O requests the on-disk controllers, which have limited queue sizes, are unable to completely optimize the accesses. This seems to make a pretty big difference on the twe device I tested with when running blogbench on HAMMER, which can approach 1000 simultaniously queued I/O's. --- diff --git a/sys/dev/raid/aac/aacvar.h b/sys/dev/raid/aac/aacvar.h index ec4966bbd4..2f7068268f 100644 --- a/sys/dev/raid/aac/aacvar.h +++ b/sys/dev/raid/aac/aacvar.h @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/aac/aacvar.h,v 1.4.2.7 2003/04/08 13:22:08 scottl Exp $ - * $DragonFly: src/sys/dev/raid/aac/aacvar.h,v 1.21 2008/04/06 19:03:18 pavalos Exp $ + * $DragonFly: src/sys/dev/raid/aac/aacvar.h,v 1.22 2008/06/10 17:20:48 dillon Exp $ */ #include @@ -599,7 +599,7 @@ aac_initq_bio(struct aac_softc *sc) static __inline void aac_enqueue_bio(struct aac_softc *sc, struct bio *bio) { - bioq_insert_tail(&sc->aac_bioq, bio); + bioqdisksort(&sc->aac_bioq, bio); AACQ_ADD(sc, AACQ_BIO); } diff --git a/sys/dev/raid/amr/amrvar.h b/sys/dev/raid/amr/amrvar.h index 42932bd17b..1b35e75ace 100644 --- a/sys/dev/raid/amr/amrvar.h +++ b/sys/dev/raid/amr/amrvar.h @@ -53,7 +53,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/amr/amrvar.h,v 1.2.2.5 2002/12/20 15:12:04 emoore Exp $ - * $DragonFly: src/sys/dev/raid/amr/amrvar.h,v 1.10 2007/05/15 22:44:09 dillon Exp $ + * $DragonFly: src/sys/dev/raid/amr/amrvar.h,v 1.11 2008/06/10 17:20:49 dillon Exp $ */ #include @@ -276,7 +276,7 @@ static __inline void amr_enqueue_bio(struct amr_softc *sc, struct bio *bio) { crit_enter(); - bioq_insert_tail(&sc->amr_bioq, bio); + bioqdisksort(&sc->amr_bioq, bio); crit_exit(); } diff --git a/sys/dev/raid/ida/ida.c b/sys/dev/raid/ida/ida.c index 63018ab21e..3182113785 100644 --- a/sys/dev/raid/ida/ida.c +++ b/sys/dev/raid/ida/ida.c @@ -28,7 +28,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ida/ida.c,v 1.7.2.3 2001/03/01 01:57:32 ps Exp $ - * $DragonFly: src/sys/dev/raid/ida/ida.c,v 1.16 2007/05/15 22:44:10 dillon Exp $ + * $DragonFly: src/sys/dev/raid/ida/ida.c,v 1.17 2008/06/10 17:20:50 dillon Exp $ */ /* @@ -371,7 +371,7 @@ ida_command(struct ida_softc *ida, int command, void *data, int datasize, void ida_submit_buf(struct ida_softc *ida, struct bio *bio) { - bioq_insert_tail(&ida->bio_queue, bio); + bioqdisksort(&ida->bio_queue, bio); ida_construct_qcb(ida); ida_start(ida); } diff --git a/sys/dev/raid/ips/ips_disk.c b/sys/dev/raid/ips/ips_disk.c index a8705954a7..da1d96f1dd 100644 --- a/sys/dev/raid/ips/ips_disk.c +++ b/sys/dev/raid/ips/ips_disk.c @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/ips/ips_disk.c,v 1.4 2003/09/22 04:59:07 njl Exp $ - * $DragonFly: src/sys/dev/raid/ips/ips_disk.c,v 1.13 2007/06/17 23:50:16 dillon Exp $ + * $DragonFly: src/sys/dev/raid/ips/ips_disk.c,v 1.14 2008/06/10 17:20:52 dillon Exp $ */ #include @@ -140,7 +140,7 @@ ipsd_strategy(struct dev_strategy_args *ap) bio->bio_driver_info = dsc; devstat_start_transaction(&dsc->stats); lockmgr(&dsc->sc->queue_lock, LK_EXCLUSIVE|LK_RETRY); - bioq_insert_tail(&dsc->sc->bio_queue, bio); + bioqdisksort(&dsc->sc->bio_queue, bio); ips_start_io_request(dsc->sc); lockmgr(&dsc->sc->queue_lock, LK_RELEASE); return(0); diff --git a/sys/dev/raid/mlx/mlx.c b/sys/dev/raid/mlx/mlx.c index beb301db73..7a32e401a4 100644 --- a/sys/dev/raid/mlx/mlx.c +++ b/sys/dev/raid/mlx/mlx.c @@ -24,7 +24,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mlx/mlx.c,v 1.14.2.5 2001/09/11 09:49:53 kris Exp $ - * $DragonFly: src/sys/dev/raid/mlx/mlx.c,v 1.24 2006/12/22 23:26:24 swildner Exp $ + * $DragonFly: src/sys/dev/raid/mlx/mlx.c,v 1.25 2008/06/10 17:20:52 dillon Exp $ */ /* @@ -691,7 +691,7 @@ mlx_submit_bio(struct mlx_softc *sc, struct bio *bio) debug_called(1); crit_enter(); - bioq_insert_tail(&sc->mlx_bioq, bio); + bioqdisksort(&sc->mlx_bioq, bio); sc->mlx_waitbufs++; crit_exit(); mlx_startio(sc); diff --git a/sys/dev/raid/mlx/mlx_compat.h b/sys/dev/raid/mlx/mlx_compat.h index feeb2a1a64..c1a72a9baf 100644 --- a/sys/dev/raid/mlx/mlx_compat.h +++ b/sys/dev/raid/mlx/mlx_compat.h @@ -25,7 +25,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/mlx/mlx_compat.h,v 1.1.2.1 2001/06/25 04:37:51 msmith Exp $ - * $DragonFly: src/sys/dev/raid/mlx/mlx_compat.h,v 1.7 2006/04/30 17:22:16 dillon Exp $ + * $DragonFly: src/sys/dev/raid/mlx/mlx_compat.h,v 1.8 2008/06/10 17:20:52 dillon Exp $ */ /* * Portability and compatibility interfaces. @@ -44,7 +44,7 @@ typedef struct bio_queue_head mlx_bioq; typedef struct bio mlx_bio; typedef struct bio_queue_head mlx_bioq; # define MLX_BIO_QINIT(bq) bioq_init(&bq); -# define MLX_BIO_QINSERT(bq, bp) bioq_insert_tail(&bq, bp) +# define MLX_BIO_QINSERT(bq, bp) bioqdisksort(&bq, bp) # define MLX_BIO_QFIRST(bq) bioq_first(&bq) # define MLX_BIO_QREMOVE(bq, bp) bioq_remove(&bq, bp) # define MLX_BIO_IS_READ(bp) ((bp)->bio_cmd == BIO_READ) diff --git a/sys/dev/raid/twe/twe_compat.h b/sys/dev/raid/twe/twe_compat.h index a2293e6741..23af512130 100644 --- a/sys/dev/raid/twe/twe_compat.h +++ b/sys/dev/raid/twe/twe_compat.h @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/twe/twe_compat.h,v 1.1.2.5 2004/04/07 22:18:00 vkashyap Exp $ - * $DragonFly: src/sys/dev/raid/twe/twe_compat.h,v 1.16 2006/10/25 20:56:01 dillon Exp $ + * $DragonFly: src/sys/dev/raid/twe/twe_compat.h,v 1.17 2008/06/10 17:20:52 dillon Exp $ */ /* * Portability and compatibility interfaces. @@ -164,7 +164,7 @@ typedef struct bio_queue_head twe_bioq; typedef struct bio twe_bio; typedef struct bio_queue_head twe_bioq; # define TWE_BIO_QINIT(bq) bioq_init(&bq); -# define TWE_BIO_QINSERT(bq, bp) bioq_insert_tail(&bq, bp) +# define TWE_BIO_QINSERT(bq, bp) bioqdisksort(&bq, bp) # define TWE_BIO_QFIRST(bq) bioq_first(&bq) # define TWE_BIO_QREMOVE(bq, bp) bioq_remove(&bq, bp) # define TWE_BIO_IS_READ(bp) ((bp)->bio_cmd == BIO_READ) diff --git a/sys/dev/raid/twe/twevar.h b/sys/dev/raid/twe/twevar.h index 7d3bb296f2..671b4a3999 100644 --- a/sys/dev/raid/twe/twevar.h +++ b/sys/dev/raid/twe/twevar.h @@ -27,7 +27,7 @@ * SUCH DAMAGE. * * $FreeBSD: src/sys/dev/twe/twevar.h,v 1.1.2.8 2004/06/11 18:57:32 vkashyap Exp $ - * $DragonFly: src/sys/dev/raid/twe/twevar.h,v 1.10 2007/05/15 22:44:11 dillon Exp $ + * $DragonFly: src/sys/dev/raid/twe/twevar.h,v 1.11 2008/06/10 17:20:52 dillon Exp $ */ #define TWE_DRIVER_VERSION_STRING "1.40.01.002" @@ -281,7 +281,8 @@ static __inline void twe_enqueue_bio(struct twe_softc *sc, struct bio *bio) { crit_enter(); - bioq_insert_tail(&sc->twe_bioq, bio); + bioqdisksort(&sc->twe_bioq, bio); + /* bioq_insert_tail(&sc->twe_bioq, bio); */ TWEQ_ADD(sc, TWEQ_BIO); crit_exit(); }